

Extensions and small utilities for everyday Dart: nested maps, strings,
collections, numbers, dates, durations, debouncing, streams, URIs, and intl
formatting. The same import re-exports
convert_object for type
conversion, stringo for string
transforms, all of collection, and
the core intl formatters, so one import
covers what would otherwise be five.
It is pure Dart with no Flutter dependency, so it runs in Flutter apps, on
servers, and on the web.
Install
dart pub add dart_helper_utils
In a Flutter app, run flutter pub add dart_helper_utils. Version 7 needs
Dart 3.13.5 or later (Flutter 3.47.7 or later). Then import the one library:
import 'package:dart_helper_utils/dart_helper_utils.dart';
A quick look
final config = {
'db': {
'host': 'localhost',
'pool': {'size': '20'},
},
'tags': ['api', 'internal'],
};
print(config.getPath('db.pool.size')); // 20
print(config.flatMap()['tags.1']); // internal
print([1, 2, 3, 4, 5].chunks(2)); // [[1, 2], [3, 4], [5]]
print('1h 30m'.parseDuration().inMinutes); // 90
print(1234567.891.formatAsReadableNumber()); // 1,234,567.89
print('invoice.pdf'.isPDF); // true
print(DateTime(2024, 1, 31).addMonths(1)); // 2024-02-29 00:00:00.000
What's included
| Area | Examples |
|---|
| Maps | getPath, setPath, flatMap, unflatten, deepMerge, setIfMissing, and convert_object's typed reads (getInt, getString, getList, tryGetRaw) |
| Strings | isValidEmail, isUuid, isValidIp4, parseDuration, file-type checks by name (isPDF, isImage, isWord, mimeType), and stringo's toSnakeCase, toTitleCase, slugify, truncate, and mask |
| Collections | chunks, windowed, partition, distinctBy, swapped, getRandom, and all of package:collection (groupBy, firstWhereOrNull, mapIndexed, ...) |
| Numbers | mean, median, mode, percentile, standardDeviation; HTTP status checks (isSuccessCode, statusCodeRetryDelay); toFileSize, asGreeks, toOrdinal, isPrime |
| Dates | addDays, addMonths, addBusinessDays, nextDay, isSameDayAs, isBetween, isFuture, startOfDay, startOfMonth, firstDayOfWeek, daysInMonth, roundTo, httpDateFormat |
| Durations | toClockString, toHumanShort, delayed, and number shortcuts such as 2.secondsDelay() |
| Async | Debouncer, Throttler, TimeUtils.debounce, TimeUtils.throttle, TimeUtils.runWithTimeout, mapConcurrent, waitConcurrency, and Future minWait, timeoutOrNull, and retry |
| Streams | asPausable, rateLimit, bufferCount, window, withLatestValue, retrying stream factories, and safeAdd on a StreamController |
| URIs | rebuild, mergeQueryParameters, appendPathSegment |
| Intl | format plus about 30 formatAsX date shortcuts, formatAsCurrency, formatAsCompact, formatAsReadableNumber, pluralize, enforceRtl |
| Constants | httpStatusMessages, cssColorNamesToArgb, and precompiled validator patterns (patternValidEmail, patternValidUrl, ...) |
The API reference
documents every member.
Debouncing and throttling
final debouncer = Debouncer(
delay: const Duration(milliseconds: 300),
maxWait: const Duration(seconds: 2),
);
void onQueryChanged(String query) => debouncer.run(() => search(query));
// When the screen or service goes away:
debouncer.dispose();