Dart Examples

DartOct 23, 2026

Dart aligned plain-text CLI table renderer

Renders rows as a padded plain-text table whose column widths follow the widest cell content.

formattingtableterminalcli
000
DartOct 23, 2026

Dart Base64 encode decode with validation

Encodes and decodes Base64 text or bytes with padding normalization and clear format errors.

bytesdecodingencodingbase64
000
DartOct 23, 2026

Dart field validation with error map

Validates a map of form fields and returns per-field error messages instead of throwing early.

inputerrorsvalidationforms
000
DartOct 23, 2026

Dart query string build and parse

Builds URL query strings from maps and parses them back into a multimap of decoded values.

queryurlencodinguri
000
DartOct 23, 2026

Dart JSON decode with path-aware errors

Decodes a JSON string and rethrows parse failures with a concise message and safe input excerpt.

debuggingparsingerrorsjson
000
DartOct 23, 2026

Dart HTTP GET JSON with timeout

Performs an HTTP GET with a deadline, checks the status code, and decodes the JSON body.

clienthttpjsontimeout
000
DartOct 23, 2026

Dart bounded worker pool with results

Runs tasks across a fixed number of concurrent workers and collects either values or errors.

concurrencyasynctaskspool
000
DartOct 23, 2026

Dart environment config with defaults

Reads environment variables with typed defaults and fails fast when a required key is missing.

configenvclivalidation
000
DartOct 23, 2026

Dart token bucket rate limiter

Allows short bursts while enforcing an average request rate using a refilling token bucket.

concurrencytimingtoken-bucketrate-limit
000
DartOct 23, 2026

Dart bounded LRU cache with recency eviction

A fixed-capacity cache that evicts the least recently used entry on insert and refreshes on read.

evictionlrucachemap
000
DartOct 23, 2026

Dart multi-key sort with nulls last

Sorts records by several comparator keys, keeping stable order and placing nulls at the end.

sortnullsrecordscomparator
000
DartOct 23, 2026

Dart split iterable into fixed size batches

Yields lazy batches of at most a given size from any iterable, leaving the tail short.

lazychunkiterablebatch
000
DartOct 23, 2026

Dart stream text file line by line

Reads a text file lazily as a stream of lines, skipping blanks and reporting the line count.

streamlinesfileio
000
DartOct 23, 2026

Dart deep clone and recursive map merge

Deep-copies nested maps and lists, then merges a patch map recursively without mutating inputs.

mapsmergeclonejson
000
DartOct 23, 2026

Dart capped exponential backoff retry helper

Retries an async action with capped exponential backoff and randomized jitter between attempts.

asyncresiliencebackoffretry
000