helpers library

Constants

chars → const String
emptyList → const List
numbers → const String

Functions

alwaysFalse<T>(T input) bool
alwaysTrue<T>(T input) bool
anyMatch(String? subject, List<String> potentials, {bool caseSensitive = true}) bool
assertNotNull<T>(T value) → T
badArgument<T>({dynamic value, String? name, String? message}) → T
buildString(void builder(StringBuffer buffer)) String
capitalize(String? source) String?
catching<I, O>(O execute(I input), {String? debugLabel, Logger? logger}) Mapping<I, O?>
chopList<T>(Iterable<T> items) List<T>
compact<T>(Iterable<T?>? list) List<T>
compareBool<T>(bool toBool(T input)) Comparator<T>
convert<F, T>(F obj, {Transformer<F, T>? converter, Predicate<F>? predicate}) → T?
create<T>(Factory<T>? factory) → T?
createIf<T>(bool condition, Factory<T> factory) → T?
dateTimeOf(dynamic json) DateTime?
deepClone(dynamic _in) → dynamic
This assumes that the data coming in is a map, list, or primitive (json).
deepCloneList(Iterable _in) List
This assumes that the data coming in is a map, list, or primitive (json).
deepCloneMap(Map _in) Map<String, dynamic>
This assumes that the data coming in is a map, list, or primitive (json).
defaultIfEmpty(String? primary, String ifBlank) String?
delay([Duration duration = const Duration(milliseconds: 300)]) Future
distinctBy<T>(Iterable<T>? list, dynamic by(T input)) Iterable<T>
filterKeys<K, V>(Map<K, V> source, bool filter(K key)) Map<K, V>
filterValues<K, V>(Map<K, V> source, bool filter(V value)) Map<K, V>
find<T>(Map<String, T> container, String? id) → T?
findInitials(List? sources) String?
firstNonEmpty(Iterable<String?>? strings) String?
firstNonNull<T>([T? a, T? b, T? c, T? d, T? e, T? f]) → T?
groupBy<K, V>(List<V> values, K mappedBy(V item)) Map<K, List<V>>
ifEmpty<T>(Iterable<T>? list, {T? then}) List<T?>
illegalArg<T>(String prop, [String? message]) → T
illegalState<T>([String? message]) → T
initials(dynamic from, {int max = 2}) String?
isNullOrBlank(String? input) bool
isPhone(String input) bool
joinOrNull(Iterable<String?>? items, {String separator = " "}) String?
joinString(void builder(StringJoiner buffer), [String? separator]) String
loggerNameOf(Type type) String
Converts a type name to snake case
mapExceptFirst<T>(Iterable<T>? list, T map(T t)) List<T>
mapExceptLast<T>(Iterable<T>? list, T map(T t)) List<T>
mapIndexed<R, T>(Iterable<T> input, R mapper(T item, int index)) Iterable<R>
mapOf<K, V>(Iterable<V> values, {required K keyOf(V item)}) Map<K, V>
matchAll<T>() Predicate<T>
md5(Uint8List bytes) String
nonBlank(String? input) String?
notImplemented<T>() → T
notNull<T>() Predicate<T?>
notNullOrBlank() Predicate<String?>
nullPointer<T>(String? property) → T
properCase(String? source) String?
randomString(int length, {bool? numbersOnly, Random? rnd}) String
rangeOf(int low, int high) Iterable<int>
removeElement<T>(Iterable<T>? elements, T toRemove) List<T>
repeat(String source, int times) String
returnNull<T>() Factory<T?>
sort<T>(Iterable<T> list, Comparator<T> comparator) Iterable<T>
splitSnakeCase(String? source) String?
startsWith(String? first, String? second, {bool ignoreCase = true}) bool
sunnyLogger(Type type, {Type? subscript}) → Logger
Produces a logger using snake case naming conventions. If subscript is provided, it will be appended to the name in square brackets, eg sunny_listcontact
timed<R>(R block(), {dynamic result(R result, Duration time)?}) → R
timedAsync<R>(FutureOr<R> block(), {dynamic result(R result, Duration time)?}) Future<R>
timeSpanOf(String duration) → TimeSpan?
todo<T>([String? message]) → T
tokenizePhoneNumber(String? phoneNumber) Iterable<String>
toList<T>(dynamic value, DynTransformer<T> txr) List<T>
Converts a dynamic json value into a list, using the provided transformer to convert
toMap<T>(dynamic value, DynTransformer<T> txr) Map<String, T>
Converts a dynamic json value into a map, using the provided transformer to convert
trim(String? target, List<String>? chars, {bool trimWhitespace = true}) String?
trying<O>(O execute(), {Logger? log}) → O
uncapitalize(String source) String
uncapitalizeNull(String? source) String?
uriOf(dynamic json) Uri?
uuid() String
uuidb() List<int?>
withString<R>(Iterable<String?> strings, R handler(String string)) → R?
wrongType<T>(String name, dynamic value, List<Type> accepted) → T

Typedefs

Disposer = FutureOr Function()
Func<R> = R Function()
Predicate<T> = bool Function(T input)