flutter_extensions

Adds several extensions

Dart

Color

Extensions color code we thank "TinyColor"

String

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

num

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

Iterable

CommandDescription
tryFirstWhereType()returns a first element where type is T else null
separate(int Function(T) separator)returns a SeparatedResult separated by separator
separateByContains(Iterable iterable)returns a SeparatedResult separated by an iterable via contains method
List expandByIterable(Iterable another)returns the two iterable joined

Map<K, V> - BuiltMap<K, V>

CommandDescription
generateIterable<K, V>(T Function(K key, V value) generator)return List of MapEntry<K, V>
every<K, V>(bool test(K key, V value))
any<K, V>(bool test(K key, V value))

Dart - Flutter

DateTime - Time

TCommandDescription
DDateTime.copyWith
DDateTime.copyWithPosition
FDateTime.toTimeOfDay
FDateTime.copyWithTimeOfDay

Flutter

CommandDescription
TargetPlatformExt.isMobilereturns bool
TargetPlatformExt.isDesktopreturns bool
InputDecoration.completeWith(...)returns a copy of InputDecoration by completing it with the attributes
DataRow.copyWith(...)returns a copy of DataRow with the new attributes
DataRow.completeWith(...)returns a copy of DataRow by completing it with the attributes
DataCell.copyWith(...)returns a copy of DataCell with the new attributes
DataCell.completeWith(...)returns a copy of DataCell by completing it with the attributes

Widgets

Listenable - ChangeNotifier

WidgetDescription
ChangeableProvider...
ChangeableBuilderlisten to a Listenable and construct the ui based on the changes
ChangeableListener...
ChangeableConsumerto do...
ChangeableValueBuilderlisten to a Listenable and construct the ui based on the changes only if they respect the 'condition' or the value does not change
ChangeableValueListenerto do...
ChangeableValueConsumerto do...

RxStream

Listen to a Stream or StreamValue and filtering by previous e current state Not repeat data or AsyncSnapshot | Widget | Description | | ------- | ----------- | | RxStreamConsumer | Construct the Widget based on the AsyncSnapshot and notify change AsyncSnapshot | | RxStreamBuilder | Construct the Widget based on the AsyncSnapshot | | RxStreamListener | Notify change AsyncSnapshot | | ValueStreamConsumer | Construct the Widget based on the data and notify change data | | ValueStreamBuilder | Construct the Widget based on the data | | ValueStreamListener | Notify change data |

Others

WidgetDescription
SizeCopierUpdate a SizeCopierController with the size of the child
SizeCopyCreate a SizedWidget taking inspiration from SizeCopierController
FadeIndexStackAnimate the index widget on the Stack to enter and exit with a FadeTransition

Libraries

dart_extensions
flutter_extensions
keyboard