core_extras 1.0.1-alpha copy "core_extras: ^1.0.1-alpha" to clipboard
core_extras: ^1.0.1-alpha copied to clipboard

Extras for the core dart library This package provides a set of helpful types, utitlities and extensions that enhances the core dart library. These are little extras that you wished Dart came with, an [...]

dart-core-extras #

Provides a set of utility types and extensions to Dart core packages Some examples are provided below.

Map Extensions #

valueOf #

Returns the value of the given key, if it exists.

final animalRatings = { "aardvark": 1, "baboon": 2 };
final aardvarkRating = animalRatings.valueOf("aardvark", newValue: 0); // Returns existing value of 1
final baboonRating = animalRatings.valueOf("baboon", newValue: 2); // Adds baboon and returns the value of 2

notContainsKey #

Whether this map does not contain the given key

final animalRatings = { "aardvark": 1, "baboon": 2 };
final notContainsAardvark = animalRatings.notContainsKey("aardvark"); // false
final notContainsCat = animalRatings.notContainsKey("cat"); // true

Rect Extensions #

inflateBySize #

Returns a new rectangle with all edges moved outwards by the given size

final rect = Offset.zero & Size.square(100);
final inflated = rect.inflateBySize(Size.square(50));
// inflated.left = -50
// inflated.right = 150
// inflated.top = -50
// inflated.bottom = 150

expandBySize #

Returns a new rectangle with only the right and bottom edges moved outwards by the given size

final rect = Offset.zero & Size.square(100);
final inflated = rect.inflateBySize(Size.square(50));
// inflated.left = 0
// inflated.right = 200
// inflated.top = 0
// inflated.bottom = 200
0
likes
0
points
41
downloads

Publisher

verified publisherarchmind.io

Weekly Downloads

Extras for the core dart library This package provides a set of helpful types, utitlities and extensions that enhances the core dart library. These are little extras that you wished Dart came with, and aims to support all platforms.

Repository (GitHub)
View/report issues

Topics

#api #tool #utils #extension #framework

License

unknown (license)

Dependencies

flutter

More

Packages that depend on core_extras