usefull_extensions

Creator: coderz1093

Last updated:

0 purchases

usefull_extensions Image
usefull_extensions Images
Add to Cart

Description:

usefull extensions

Usefull Extensions 🔌 #

Generated by the Very Good CLI 🤖
A set of useful extensions and widgets for Flutter and Dart that I use regularly and that I have been collecting through the projects that I have been doing, StackOverflow questions, posts, etc...
Installing #
Add usefull extensions package to your pubspec.yaml file:
dependencies:
usefull_extensions:
copied to clipboard
Import the library into your .dart file:
import 'package:usefull_extensions/usefull_extensions.dart';
copied to clipboard

Extensions #
usefull_extensions offers different extensions, for Objects, Widgets, Strings, etc...
Joined Widgets
This extension allows us to add a separator between each element of a List
[
const Text('CARLOS'),
const Text('MOBILE SOLUTIONS'),
].joinWithSeparator(); // You can also specify your own separator Widget
//.joinWithSeparator(const SizedBox(height: 10));
copied to clipboard
Spaced Widgets
This extension allows us to add a padding to a whole List
[
const Text('CARLOS'),
const Text('MOBILE SOLUTIONS'),
].spaced(); // You can also specify your own EdgeInsetsGeometry
//.spaced(padding: const EdgeInsets.all(10));
copied to clipboard
Log on Object #
This extensions emits a log event of the current object, and returns the length of the output log
Usage: log
final testString = 'My String';
testString.log();
// Outputs -> 'My String' as a log event
copied to clipboard
Unwrapped String on Object? #
This extension allows us to safely unwrap a string, returning - by default if it's null
Usage: unwrappedString
null.unwrappedString(); // '-'
null.unwrappedString('🍰'); // '🍰'
'My test'.unwrappedString('?'); // My test
copied to clipboard
Detailed Where on Map<K, V> #
This set of extensions allows us to find an entry based on key, value, or both
Usage: where, whereKey and whereValue
<String, int>{'John': 20, 'Mary': 21, 'Peter': 20}

..where((key, value) => key.length > 4 && value >= 20) // {Peter: 22}

..whereKey((key) => key.length < 5) // {John: 20, Mary: 21}

..whereValue((value) => value.isEven); // {John: 20, Peter: 22}
copied to clipboard
Capitalization on String #
This extensions allows us to safely capitalize or title-case a String
Usage: toCapitalized and toTitleCase
'carlos g'.toCapitalized(); // Carlos g
'carlos g'.toTitleCase(); // Carlos G
copied to clipboard
Widgets #
usefull_extensions offers different Widgets
Spacer Widgets
A list of spacers, both vertically and horizontally
Usage: VerticalSpacer, HorizontalSpacer and VerticalSpacerWithText
[
// Vertical
VerticalSpacer.xSmall(),
VerticalSpacer.small(),
VerticalSpacer.normal(),
VerticalSpacer.semi(),
VerticalSpacer.mediumSmall(),
VerticalSpacer.medium(),
VerticalSpacer.medium20(),
VerticalSpacer.mediumLarge(),
VerticalSpacer.large(),
VerticalSpacer.xLarge(),
VerticalSpacer.xxLarge(),
VerticalSpacer.xxxLarge(),

// Horizontal
HorizontalSpacer.small(),
HorizontalSpacer.normal(),
HorizontalSpacer.semi(),
HorizontalSpacer.mediumSmall(),
HorizontalSpacer.medium(),
HorizontalSpacer.medium20(),
HorizontalSpacer.mediumLarge(),
HorizontalSpacer.large(),
HorizontalSpacer.xLarge(),
HorizontalSpacer.xxLarge(),

// Vertical with text
VerticalSpacerWithText(text: 'example text'),
]
copied to clipboard
ThemeData on BuildContext #
This extensions allows us to access a themedata based on the current context
final theme = context.theme; // Current ThemeData
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.