Dart Examples
Dart aligned plain-text CLI table renderer
Renders rows as a padded plain-text table whose column widths follow the widest cell content.
Dart Base64 encode decode with validation
Encodes and decodes Base64 text or bytes with padding normalization and clear format errors.
Dart field validation with error map
Validates a map of form fields and returns per-field error messages instead of throwing early.
Dart query string build and parse
Builds URL query strings from maps and parses them back into a multimap of decoded values.
Dart JSON decode with path-aware errors
Decodes a JSON string and rethrows parse failures with a concise message and safe input excerpt.
Dart HTTP GET JSON with timeout
Performs an HTTP GET with a deadline, checks the status code, and decodes the JSON body.
Dart bounded worker pool with results
Runs tasks across a fixed number of concurrent workers and collects either values or errors.
Dart environment config with defaults
Reads environment variables with typed defaults and fails fast when a required key is missing.
Dart token bucket rate limiter
Allows short bursts while enforcing an average request rate using a refilling token bucket.
Dart bounded LRU cache with recency eviction
A fixed-capacity cache that evicts the least recently used entry on insert and refreshes on read.
Dart multi-key sort with nulls last
Sorts records by several comparator keys, keeping stable order and placing nulls at the end.
Dart split iterable into fixed size batches
Yields lazy batches of at most a given size from any iterable, leaving the tail short.
Dart stream text file line by line
Reads a text file lazily as a stream of lines, skipping blanks and reporting the line count.
Dart deep clone and recursive map merge
Deep-copies nested maps and lists, then merges a patch map recursively without mutating inputs.
Dart capped exponential backoff retry helper
Retries an async action with capped exponential backoff and randomized jitter between attempts.