pure_extensions 5.0.0

SDKdartflutter
Platformandroidioswindowslinuxmacosweb

It adds utility extensions to the dart classes and adds some utility classes, builders.

Dart Extensions

Adds several extensions

classDescription
GeoPointDefines a geographical point.
GeoBoundsA latitude/longitude aligned rectangle.
CompositeMapSubscriptionActs as a map for multiple subscriptions that can be canceled at once.
ReadableFileImplement a multi platform interface to be able to read a file.
DurationBuilderBuilder for [Duration]
DateTimeBuilderBuilder for [DateTime]
UriBuilderBuilder for [Uri]

- Color

Extensions color code we thank "TinyColor"

- String

See recase for many other extensions

CommandDescription
ifEmpty(() => 'text')if string is empty returns a 'text' otherwise return string
isBlankif string is empty or contains only space returns true otherwise returns false
ifBlank(() => 'text')if string is empty or contains only space returns 'text' otherwise returns string
more methods... please complete this list...

- num

They are extended with the methods of the 'math' package

- Iterable< T >

See collection for many others extensions

CommandDescription
nullIfEmptyreturns null or if it is empty returns true.
replacesreplace the old elements contained in the map with new ones.
whereNotContainsReturns a iterable without bad elements.
joinByConcatenates the elements given by function.
joinElementConcatenates the elements.
containsEveryChecks whether every element of this iterable is in [other] iterable.
containsAnyChecks whether any element of this iterable is in [other] iterable.
groupBySplits a list into sub-lists stored in an object, based on the result.
generateMapGenerate the map by collection.
elementAtOrNullReturns the [index]th element or null if it not exist.
- Iterable< num/int/double/BigInt/Rational >
CommandDescription
sumCalculate the sum of all numbers in the collection
averageCalculate the average of all numbers in the collection
subtractCalculate the subtraction of all numbers in the collection
divideCalculate the division of all numbers in the collection
multiplyCalculate the multiplication of all numbers in the collection
sumAllBySum [number] to all items in the collection
subtractAllBySubtract [number] to all items in the collection
divideAllByDivide [number] to all items in the collection
multiplyAllByMultiply [number] to all items in the collection
- Iterable< MapEntry< K, V > >
CommandDescription
toMapConvert the collection of entries into a [Map].
toMapListGrouping the results in list according to key.
keysReturns only the keys.
valuesReturns only the values.
- Iterable< Future< T > >
CommandDescription
waitFuturessame as [Future.wait] method
anyFuturessame as [Future.any] method
- Iterable< GeoPoint >
CommandDescription
centerCalculate a center.
northeastCalculate the northeast corner.
southwestCalculate the southwest corner.
internalBoundsCalculate the internal corners.
externalBoundsCalculate the external corners.

- Map< K, V >

CommandDescription
whereNotNullReturns [Map] without null keys and values.
generateIterable<K, V>(T Function(K key, V value) generator)returns a List from entries
whereReturns a new map with all entries that satisfy [test].
firstWhereReturns the first entry that satisfies [test].
lastWhereReturns the last entry that satisfies [test].
singleWhereReturns the single element that satisfies [test].
firstOrNullReturns the first entry if it exists otherwise null.
lastOrNullReturns the last entry if it exists otherwise null.
singleOrNullReturns the single entry if it exists otherwise null.
reduceReduces a map to a single value by iteratively combining entries.
everyChecks whether every entry of this map satisfies [test].
anyChecks whether any entry of this map satisfies [test].
foldReduces a map to a single value by iteratively combining entries.
getReturns the value [key].
getOrNullReturns the value [key] or null if it not exist.

- DateTime (DateTimeBuilder)

CommandDescription
DateTime.copyWithPosition

- Duration (DurationBuilder)

CommandDescription
daysHuman days representation (0 -> ...)
hoursHuman hours representation (0 -> 24)
minutesHuman minutes representation (0 -> 59)
secondsHuman seconds representation (0 -> 59)
millisecondsHuman milliseconds representation (0 -> 999)
microsecondsHuman microseconds representation (0 -> 999)
copyWithCopy this with new values
toBuilderConverts this in builder
rebuildUpdate this by [DurationBuilder]

- Stream< T >

CommandDescription
asStreamreturns itself with the [Stream] type.
asBroadcastreturns a broadcast stream without wrapping it unnecessarily.
onTrackedErrorResumeIt is similar to [Rx.OnErrorExtensions.onErrorResume] but with [StackTrace].
onTrackedErrorReturnWithIt is similar to [Rx.OnErrorExtensions.onErrorReturnWith] but with [StackTrace].
distinctRuntimeTypeStream.distinct] by [T.runtimeType].
distinctRuntimeTypeStream.distinct] by [T.runtimeType].
whereNotNull