essential_utils 0.0.1
essential_utils: ^0.0.1 copied to clipboard
Essential Utils: A comprehensive suite of utilities designed to enhance Flutter development. This package includes DateUtils for efficient date handling, StringUtils for advanced string operations, an [...]
Essential Utils #
Overview #
Essential Utils is a robust suite of utilities designed to enhance the development experience in Flutter projects. With DateUtils, StringUtils, and ColorUtils, this package provides developers with the tools needed to handle dates, strings, and colors more effectively and efficiently. Reduce boilerplate, ensure UI consistency, and improve accessibility with minimal effort.
Features #
- DateUtils: Functions to format dates and calculate relative times.
- StringUtils: Enhanced string manipulation capabilities including capitalization and palindrome checks.
- ColorUtils: Tools to generate Material color swatches and determine optimal text colors based on background luminance.
Getting Started #
Installation #
To add FlutterToolkit to your Flutter project, include it in your pubspec.yaml file:
dependencies:
flutter_toolkit: ^1.0.0
Then run the following command to install the package:
flutter pub get
Importing #
To use the utilities in your project, simply import the package:
import 'package:flutter_toolkit/flutter_toolkit.dart';
Usage #
DateUtils #
DateTime now = DateTime.now();
String formattedDate = DateUtils.formatAsUsDate(now);
String timeAgo = DateUtils.timeAgoSinceDate(now.subtract(Duration(days: 1)));
StringUtils #
String capitalized = StringUtils.capitalizeWords("hello world");
bool isPalindrome = StringUtils.isPalindrome("racecar");
ColorUtils #
Color primaryColor = Color(0xFF6A1B9A);
MaterialColor materialColor = ColorUtils.createMaterialColor(primaryColor);
Color fontColor = ColorUtils.getBestFontColor(primaryColor);
License #
Essential Utils is available under the MIT license. For more information, see the LICENSE file in the repository.