_common
library
Extensions
CartesianProductOnIterableExt
on Iterable <Iterable <T > >
ChunkedOnIterableExt
on Iterable <T >
DeepGetOnMapExt
on Map
GenericTypeOnIterableExt
on Iterable <T >
GenericTypeOnMapExt
on Map <K , V >
JoinWithLastSeparatorOnIterableExt
on Iterable
MapKeysAndValyesOnMapExt
on Map <K1 , V1 >
MapWithDefaultOnMapExt
on Map <K , V >
MaybeAddToIterableExt
on Iterable <T >
MaybeAddToListExt
on List <T >
MaybeAddToMapExt
on Map <T1 , T2 >
MaybeAddToSetExt
on Set <T >
NonNullKeysOnMapExt
on Map <K? , V >
NonNullsOnMapExt
on Map <K? , V? >
NonNullValuesOnMapExt
on Map <K , V? >
NullIfEmptyOnIterableExt
on Iterable <T >
NullIfEmptyOnListExt
on List <T >
NullIfEmptyOnMapExt
on Map <T1 , T2 >
NullIfEmptyOnQueueExt
on Queue <T >
NullIfEmptyOnSetExt
on Set <T >
SetNestedValueOnMapExt
on Map
TakeLastOnIterableExt
on Iterable <T >
ToMapOnIterableExt
on Iterable <MapEntry <K , V > >
TraverseMapOnMapExt
on Map <K , V >
TryMergeOnIterableExt
on Iterable <Iterable <T > ? >
TryReduceOnIterableExt
on Iterable <T >
UniqueOnIterableExt
on Iterable <T >
UniqueOnMapEntryIterableExt
on Iterable <MapEntry <K , V > >
UnmodifiableOnListExt
on List <T >
UnmodifiableOnMapExt
on Map <K , V >
UnmodifiableOnSetExt
on Set <T >
Functions
cartesianProduct <T > (Iterable <Iterable <T > > source , T combinator (T a , T b ) )
→ Iterable <T >
Creates the Cartesian product of the iterables and combines each resulting
pair using the combinator function.
chunked <T > (Iterable <T > source , int chunkSize )
→ Iterable <Iterable <T > >
Splits the source into chunks of a maximum size specified by chunkSize.
combinedOrderedStringId (List <String > ids , {String separator = '_' })
→ String
Generates an ordered ID from a list of unordered IDs, that can be
used to identify the list of IDs.
deepGet (Map ? map , String path , {String separator = '.' })
→ dynamic
Safely retrieves and converts a value from a nested data structure using a
dot-separated path.
deepGetFromSegments (Map ? map , Iterable pathSegments )
→ dynamic
Safely retrieves and converts a value from a nested data structure using a
list of path pathSegments.
getSetDifference <T > (Set <T > before , Set <T > after )
→ Set <T >
Returns the difference between two sets.
maybeAddToIterable <T > (Iterable <T > ? source , Iterable <T > ? add )
→ Iterable <T > ?
Adds add to source if both are not null.
maybeAddToList <T > (List <T > ? source , List <T > ? add )
→ List <T > ?
Adds add to source if both are not null.
maybeAddToMap <T1 , T2 > (Map <T1 , T2 > ? source , Map <T1 , T2 > ? add )
→ Map <T1 , T2 > ?
Adds add to source if both are not null.
maybeAddToSet <T > (Set <T > ? source , Set <T > ? add )
→ Set <T > ?
Adds add to source if both are not null.
mergeDataDeep (dynamic a , dynamic b , [dynamic elseFilter (dynamic )? ])
→ dynamic
Deeply merges a and b. The returned structure does not share any
mutable substructure with either input — mutating the result is safe and
will not affect a or b.
mergeDataDeepIncludeCallsToJson (dynamic a , dynamic b )
→ dynamic
mergeDataDeepIncludeCallsToMap (dynamic a , dynamic b )
→ dynamic
mergeIterables (dynamic a , dynamic b )
→ Iterable
Concatenates two iterables (or wraps scalars as single-element iterables).
Items that are themselves Maps, Lists, Sets or Queues are
deep-copied so the result does not alias the inputs.
mergeListsSetsOrQueues (Iterable a , Iterable b , [dynamic elseFilter (dynamic )? ])
→ Iterable
Merges two iterable structures. The result does not share any mutable
substructure with either input — items are deep-copied where applicable.
mergeMapsDeep <K , V > (List <Map <K , V > > maps )
→ Map <K , V >
nullFilteredList <T > (Iterable input )
→ List <T >
Converts input to a List with non-null elements if T is non-null.
nullFilteredMap <K , V > (Map input )
→ Map <K , V >
Converts input to a Map with non-null keys and values if K and V are
non-null.
nullFilteredSet <T > (Iterable input )
→ Set <T >
Converts input to a Set with non-null elements if T is non-null.
nullIfEmpty <T > (T value )
→ T?
Returns null if value is empty, otherwise returns value.
traverseMap (Map map , Iterable keys , {dynamic newValue })
→ dynamic
Traverses a Map using a list of keys. If the keys do not exist, they are
created. If newValue is provided, the value at the end of the traversal is
set to newValue.
tryToJson (dynamic object )
→ dynamic
Returns object.toJson() if it exists, otherwise the object itself.
Only swallows NoSuchMethodError from a missing toJson member — any
exception thrown by a present toJson propagates to the caller so
data-integrity bugs are not hidden.
tryToMap (dynamic object )
→ dynamic
Returns object.toMap() if it exists, otherwise the object itself.
Only swallows NoSuchMethodError from a missing toMap member — any
exception thrown by a present toMap propagates to the caller so
data-integrity bugs are not hidden.
unique <T > (Iterable <T > src , [bool equals (T a , T b )? ])
→ Iterable <T >
Returns a new iterable with all duplicate elements removed.
uniqueEntries <K , V > (Iterable <MapEntry <K , V > > entries )
→ List <MapEntry <K , V > >
uniqueKeys <K , V > (Iterable <MapEntry <K , V > > entries )
→ List <MapEntry <K , V > >
uniqueValues <K , V > (Iterable <MapEntry <K , V > > entries )
→ List <MapEntry <K , V > >