π§° Flutter Extension Utils
Extensions that just make sense.
A handy collection of Dart and Flutter extension methods to supercharge your development experience β clean syntax, reusable logic, and expressive code, all in one lightweight package.
Designed to save you time, reduce boilerplate, and improve readability across widgets, strings, numbers, booleans, and BuildContext.
π Installation & Setup
The package can be installed using the command
flutter pub add mayr_extensions
And can then be imported using
import 'package:mayr_extensions/mayr_extensions.dart';
π Features
This package provides a comprehensive set of extension methods for Flutter and Dart development:
π¦ Available Extensions
- π§± BuildContext Extensions - Easy access to form, navigator, scaffold, media query, and device type checks
- β
Bool Extensions - Boolean utilities including
choose(),toInt(),toYesNo() - ποΈ DateTime Extensions - Date manipulation, time checks, age calculations, and formatting
- β³ Duration Extensions - Delay execution, readable strings, and duration comparisons
- π· Object Extensions - Kotlin-inspired
let()andalso()for elegant chaining - π Dynamic Extensions - Nullable utilities and debug helpers
- πΌοΈ Image Extensions - Quick
CircleAvatarcreation fromImageProvider - π’ Number Extensions - Numeric utilities, formatting, random generators, and duration conversions
- π€ String Extensions - String manipulation, casing, pattern matching, and pretty printing
- π§© Iterable/List Extensions - Safe access, transformations, aggregations, and query operations
- πΊοΈ Map Extensions - Map transformations, merging, and filtering
- π’ Set Extensions - Set operations like toggle, intersects, subset checks
- π― Humanize Extensions - Convert values to human-readable strings
- π§© Widget Extensions - Widget transformations for padding, positioning, clipping, and tap handling
- π DateTimeFormat - Pre-defined date/time format strings
β¨ Quick Examples
// Duration helpers
await 2.seconds.delay(() => print('Done!'));
// String utilities
'hello world'.camelCase; // helloWorld
'user@example.com'.isEmail; // true
// List operations
[1, 2, 3].firstOrNull(); // 1
[1, null, 2].whereNotNull(); // [1, 2]
// Number formatting
1234.5.formatAsCurrency(locale: 'en_US', symbol: '\$'); // \$1,234.50
// Widget helpers
Text('Hello').paddingAll(16).center();
// Boolean utilities
true.choose('Yes', 'No'); // 'Yes'
For detailed documentation on each extension type, click the links above or visit the doc directory.
Usage
To use, simply import the package into your project and you can then all of the extensions it provdes π«ΆπΎ
import 'package:mayr_extensions/mayr_extensions.dart';
π’ Additional Information
π€ Contributing
Contributions are highly welcome! If you have ideas for new extensions, improvements, or fixes, feel free to fork the repository and submit a pull request.
Please make sure to:
- Follow the existing coding style.
- Write tests for new features.
- Update documentation if necessary.
Let's build something amazing together!
π Reporting Issues
If you encounter a bug, unexpected behaviour, or have feature requests:
- Open an issue on the repository.
- Provide a clear description and steps to reproduce (if it's a bug).
- Suggest improvements if you have any ideas.
Your feedback helps make the package better for everyone!
π Licence
This package is licensed under the MIT License β which means you are free to use it for commercial and non-commercial projects, with proper attribution.
See the LICENSE file for more details.
π Support
If you find this package helpful, please consider giving it a βοΈ on GitHub β it motivates and helps the project grow!
You can also support by:
- Sharing the package with your friends, colleagues, and tech communities.
- Using it in your projects and giving feedback.
- Contributing new ideas, features, or improvements.
Every little bit of support counts! ππ