dart_helper_utils 2.0.0-beta.2
dart_helper_utils: ^2.0.0-beta.2 copied to clipboard
This package offers a collection of Dart utilities, tools for converting dynamic objects to various types, and extending core Dart classes with extensions.
CHANGELOG #
2.0.0 #
In this version, we have made extensive use of the intl package with a comprehensive set of new extensions to provide robust localization and formatting capabilities.
- Intl Extensions:
- General:
- Map:
intlSelectLogic,intlSelect - Num:
pluralize,getPluralCategory - String:
setAsDefaultLocale,setAsSystemLocale,translate,genderSelect,getGenderCategory
- Map:
- DateFormat:
- DateTime:
tryFormat,format, and various formatting methods. - String:
dateFormat,toDateFormatted,toDateFormattedLoose,toDateFormattedStrict,toDateFormattedUtc,localeExists.
- DateTime:
- Bidi Extensions:
- TextDirection:
toBidiFormatter - String: Various bidi text manipulation methods.
- TextDirection:
- NumberFormat Extensions:
- String:
toNumFormatted,toIntFormatted,toDoubleFormatted. - Num:
formatAsCurrency,formatAsCompact, and various other formatting methods.
- String:
- General:
Enhancements and Fixes #
- Enhanced number and date conversion functions (
toNum,tryToNum,toInt,tryToInt,toDouble,tryToDouble,toDateTime,tryToDateTime) to include optionalformatandlocaleparameters. - Fixed an issue in
makeEncodableon Maps where sets were not properly converted to JSON-encodable lists. - Consolidated several DateTime manipulation methods to ensure consistency and accuracy.
- Addressed various minor bugs and inconsistencies in existing extension methods.
- Enhanced documentation across several methods to improve clarity and usability.
Breaking Changes #
toDateWithFormatreplaced withtoDateFormatted()on String.lastDayOfWeekandfirstDayOfWeekare now methods with an optionalstartOfWeekparameter to customize the first day of the week (defaults to Monday). Improved time zone handling and added tests.
1.2.0 #
-
New Feature: Added the
toWordsgetter onString, which converts anyStringto aList<String>, handling complex cases more effectively than the nativesplit()method.-
Example Usage:
print("FlutterAndDart_are-AWESOME".toWords); // [Flutter, And, Dart, are, AWESOME]
-
1.1.0 #
Enhancements
- String Case Conversions:
capitalizeFirstLetter: Now only capitalizes the first letter, preserving the rest of the case.- NEW:
capitalizeFirstLowerRest: Provides the previous behavior, capitalizing the first letter and lowercasing the rest.
Added
-
Expanded String Case Conversions: Added comprehensive case conversion extensions:
toPascalCase: PascalCase (UpperCamelCase).toTitleCase: Title Case.toCamelCase: camelCase (dromedaryCase).toSnakeCase: snake_case (snail_case, pothole_case).toKebabCase: kebab-case (dash-case, lisp-case, spinal-case).toScreamingSnakeCase: SCREAMING_SNAKE_CASE (MACRO_CASE, CONSTANT_CASE, ALL_CAPS).toScreamingKebabCase: SCREAMING-KEBAB-CASE (COBOL-CASE).toPascalSnakeCase: Pascal_Snake_Case.toPascalKebabCase: Pascal-Kebab-Case.toTrainCase: Train-Case (HTTP-Header-Case).toCamelSnakeCase: camel_Snake_Case.toCamelKebabCase: camel-Kebab-Case.toDotCase: dot.case.toFlatCase: flatcase.toScreamingCase: SCREAMINGCASE (UPPERCASE).
-
Nullable String Handling: Added extensions for case conversion of nullable strings:
lowercaseFirstLetter: Lowercases only the first letter of the string, preserving the rest of the case.capitalizeFirstLowerRest: Capitalizes the first letter of the string and lowers the rest.tryToLowerCase: same as the nativetoLowerCase()but for nullable strings.tryToUpperCasesame as the nativetoUpperCase()but for nullable strings.
-
String Utility:
isBlank: Alias forisEmptyOrNull, checks if a string is null, empty, or solely whitespace.
1.0.1 #
- Updated the README.
1.0.0 - 2024-05-25 #
Initial release of dart_helper_utils, which includes all the Dart utilities from flutter_helper_utils up to version
4.1.0
Added
ConvertObjectclass now accepts raw JSON strings forList,Set, andMapconversions, e.g.,tryToList<int>("[1,2,3]").- New
TimeUtilsclass for measuring and comparing execution times, with methods like:executionDuration: Calculates the duration of a task (synchronous or asynchronous).executionDurations: Measures execution times for a list of tasks.compareExecutionTimes: Compares the execution durations of two tasks.throttle: Creates a throttled function that invokes the function at most once per specified interval.runPeriodically: Executes a function periodically with a given interval.runWithTimeout: Executes a function with a timeout, cancelling if it exceeds the specified duration.
Notes
- Future updates and feature changes for Dart-specific utilities will be added to the
dart_helper_utilspackage. - If you were using Dart-specific utilities from
flutter_helper_utils, migrate todart_helper_utils. If you are using both Flutter and Dart utilities, you can continue usingflutter_helper_utilsas it exportsdart_helper_utilsinternally. - This package aims to provide comprehensive Dart utilities for non-Flutter projects.