core_extras 1.0.9-alpha copy "core_extras: ^1.0.9-alpha" to clipboard
core_extras: ^1.0.9-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 [...]

core_extras #

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

Map Extensions #

valueOf #

Returns the value of the given key, if it exists, and adds it if it doesn't

final animalRatings = { "aardvark": 1, "baboon": 2 };
final aardvarkRating = animalRatings.valueOf("aardvark", initialValue: 0); // Returns existing value of 1
final baboonRating = animalRatings.valueOf("baboon", initialValue: 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 & const Size.square(100);
final inflated = rect.inflateBySize(const Size(50, 100));
// inflated.left = -50
// inflated.top = -100
// inflated.right = 150
// inflated.bottom = 200

expandBySize #

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

final rect = Offset.zero & const Size.square(100);
final expanded = rect.inflateBySize(const Size.square(50));
// expanded.left = 0
// expanded.top = 0
// expanded.right = 200
// expanded.bottom = 200
0
likes
140
points
48
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.

Topics

#api #tool #utils #extension #framework

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on core_extras