CHANGELOG
2.0.1
- NEW: Introducing Watcher state management, It's designed to be efficient, lightweight, and leverages native Flutter state management mechanisms. more here
1.6.0
- BREAKING CHANGE: Upgraded to Flutter 3.16 and resolved a deprecation on the BuildContext extension for MediaQuery by changing
context.textScaleFactortocontext.textScaler. - NEW: added New getters to the BuildContext extension for MediaQuery to support all properties on MediaQuery even the nullable.
1.5.8
NEW: Added
makeMapEncodableto our global helper methods. This function provides a convenient way to ensure all elements within a map are encodable to JSON format.UPDATE: Updated the
isValidUrlfunction's regular expression to handle URLs with special characters like[]and(). This update addresses the issue of catastrophic backtracking, Which might cause freezing or performance issues.
1.5.7
- added
maybePopto the Navigation extension to respectonWillPopwidget action. - Hosted new documentation website
1.5.6
- Added a New Uri extension to help convert string (supports nullable strings) link to uri,
toUriandtoPhoneUri.
1.5.4
- Added a new
formatargument to thetoDateTimeandtryDateTimemethods, allowing you to specify the converted date format. - Updated and enhanced the entire documentation.
1.5.3
- Added global conversion functions mirroring the static methods in
ConvertObject, providing alternative easy less code usage options.
For example:
// Use this shorter way to convert values.
final stringList = toList<String>(dynamicValue);
// If 'toList' name is already defined in your code, use this way to avoid conflicts.
final stringList = ConvertObject.toList<String>(dynamicValue);// Use this shorter way to convert values.
final stringList = toList<String>(dynamicValue);
// If 'toList' name is already defined in your code, use this way to avoid conflicts.
final stringList = ConvertObject.toList<String>(dynamicValue);1.5.1
- NEW: Added
dismissActivePopupmethod to theNavigatorExtensionextension onBuildContext. This method programmatically and recursively dismisses any active pop-up elements like dialogs, modal bottom sheets, and Cupertino modal popups. It checks for the typesPopupRoute,DialogRoute,RawDialogRoute,ModalBottomSheetRoute, andCupertinoModalPopupRouteto determine if a pop-up is currently displayed and closes it. If multiple pop-ups are stacked, the method will recursively close all of them.
1.5.0
- UPDATE: update flutter version boundaries to be
sdk: '>=3.0.6 <4.0.0'
1.4.9
- FIX: Fixed
isTomorrow,isToday,isYesterdaygetters in DateTime extensions.
1.4.8
BREAKING CHANGE: Renamed the
delayfunction in the Duration extension to bedelayedto avoid conflicts with other packagesUPDATE: Updated the
remainingDays,passedDaysgetter in the DateTime extension to correctly consider the day ending at midnight.NEW: Added the
remainingDuration,passedDurationgetter to the DateTime extension for calculating the remaining duration between two dates.
For example:
final date = DateTime(2030);
final remainingDuration = date.remainingDuration(DateTime.now());
final date = DateTime(2030);
final remainingDuration = date.remainingDuration(DateTime.now());1.4.7
- NEW: Added new function
toTitleon String Extension which is similar totoTitleCasebut ignores the '-' and '_' characters. This is useful when users name events, products, etc. and want these characters to be shown in the correct format. For example,flutter-and-dartbecomesFlutter-And-Dartwhen usingtoTitle.
1.4.6
- FIX: Fixed a bug when using
listIndexon ConvertObject functions that may cause the list return null.
1.4.5
- UPDATE: Enhanced the
asGreeksgetter to include all available Greek symbols for converting large numbers. Now, the symbols used are['K', 'M', 'B', 'T', 'Q', 'P', 'E', 'Z', 'Y']. This allows for more accurate representation of large numbers, such as converting 1000000000 to 1.0B.
1.4.4
NEW: Added new extensions to the
String?class:isValidIp4,isValidIp6, andisValidUrl. These extensions provide convenient methods to check the validity of IPv4 addresses, IPv6 addresses, and URLs respectively.NEW: Introduced a new method called
popRootto theNavigatorExtension. This method calls the normalpopmethod but with therootNavigatorparameter set totrueunder the hood. This feature proves to be useful in scenarios where dialogs need to be dismissed.
1.4.3
NEW: The convert object methods now include an optional
listIndexparameter, enabling the conversion of specific values within aList. This enhancement provides flexibility by allowing developers to extract and convert targeted values based on the specifiedlistIndex.For example:
dynamic object1 = ['John', '30', 'yes'];
final double age = ConvertObject.toDouble(object1, listIndex: 1); // 30.0
dynamic object1 = ['John', '30', 'yes'];
final double age = ConvertObject.toDouble(object1, listIndex: 1); // 30.0- NEW: The
Listextension now includes thefromIndexmethod, providing null-safe retrieval of values at specific indices within a list. It returns null if the index is out of bounds or if the list is empty or null.
1.4.2
- UPDATE: Updated Documentation.
1.4.1
NEW: The convert object methods now include an optional
mapKeyparameter, enabling the conversion of specific values within a Map object. This enhancement provides flexibility by allowing developers to extract and convert targeted values based on the specifiedmapKey.For example:
dynamic object1 = {'name': 'John', 'age': '30', 'isHuman': 'yes'};
final double age = ConvertObject.toDouble(object1, mapKey: 'age'); // 30.0
final bool isHuman = ConvertObject.toBool(object1, mapKey: 'isHuman'); // true
dynamic object1 = {'name': 'John', 'age': '30', 'isHuman': 'yes'};
final double age = ConvertObject.toDouble(object1, mapKey: 'age'); // 30.0
final bool isHuman = ConvertObject.toBool(object1, mapKey: 'isHuman'); // true1.4.0
UPDATE: Removing support of Iterables and Maps from
toTypeandtryToTypefunctions due to some restrictions in dart generics. Here is the list of the supported conversion types:boolintBigIntdoublenumStringDateTime
For Iterables and Maps, use the preferred methods from the
ConvertObjectclass:- To convert to a
List, useConvertObject.toList<String>(dynamicIterableData). - To convert to a
Set, useConvertObject.toSet<String>(dynamicIterableData). - To convert to a
Map, useConvertObject.toMap<String, int>(dynamicMapData).
- To convert to a
1.3.8
- BREAKING CHANGES: The navigation extension methods have been renamed to avoid conflicts with other packages, such as
go_router. Please update your codebase to use the new method names accordingly. - Renamed navigation extension methods:
context.pushchanged tocontext.pushPagecontext.pushReplacementchanged tocontext.pReplacementcontext.pushAndRemoveUntilchanged tocontext.pAndRemoveUntilcontext.pushNamedAndRemoveUntilchanged tocontext.pNamedAndRemoveUntilcontext.pushNamedchanged tocontext.pNamedcontext.pushReplacementNamedchanged tocontext.pReplacementNamed- The
context.popPagemethod remains unchanged since it has already been resolved in a previous version.
We apologize for any inconvenience caused by this breaking change. If you encounter any issues or need assistance, please don't hesitate to reach out.
1.3.7
- NEW: Introducing
toTypeandtryToTypeglobal functions. They allow converting a dynamic object to a specific typeTand automatically detect the type, invoking the appropriate function from theConvertObjectclass.
Sample:
dynamic data = 12.4;
final myInt = toType<int>(data); // tryToType behaves similarly but is null-safe
dynamic data = 12.4;
final myInt = toType<int>(data); // tryToType behaves similarly but is null-safe- NEW: Added
BigIntandtryBigIntin the ConvertObject class.BigIntrepresents arbitrarily large integers. It is used when you need to perform operations on integers that exceed the maximum value that can be represented by the int type. It's IMPORTANT to note that BigInt operations can be computationally expensive, especially for huge integers. Therefore, use BigInt only when necessary, and be mindful of performance implications.
Sample:
String largeNum = '12434535367326235634';
final BigInt myBigInt = ConvertObject.toBigInt(largeNum);
// OR
final BigInt myBigInt = toType<BigInt>(largeNum);
String largeNum = '12434535367326235634';
final BigInt myBigInt = ConvertObject.toBigInt(largeNum);
// OR
final BigInt myBigInt = toType<BigInt>(largeNum);- UPDATE: The
toList<T>,tryToList<T>,toSet<T>andtryToSet<T>functions now support converting any type ofIterable.
1.3.6
- UPDATE: The
toList<T>andtryToList<T>functions now support converting map values to a list if the value's type matchesT. This enhancement adds more flexibility and convenience when working with collections.
1.3.5
NEW: Added
showMaterialBanner,showSnackBar,hideCurrentMaterialBanner,hideCurrentSnackBar,removeCurrentMaterialBanner,removeCurrentSnackBar,clearMaterialBanners,clearSnackBarsonBuildContext. Usage example could be as easy ascontext.removeCurrentSnackBar.NEW: Added
focusScope,hasFocus,unFocus, andrequestFocuscall back on BuildContext.requestFocusis commonly used to hide keyboard on onTap/onPress call. Usage could beonTap: () => context.requestFocusoronTap: context.requestFocusCall.NEW: Added new enum called
HttpResStatusthat contains all http response codes with description to each one, and also some helper getters such asisSuccessful. Usage with http package could be:dartfinal res = await http.post(...); // assume it retrun res code 505 print(res.statusCode.toHttpResStatus); // will print "Insufficient Storage"final res = await http.post(...); // assume it retrun res code 505 print(res.statusCode.toHttpResStatus); // will print "Insufficient Storage"UPDATE: Use MediaQuery as InheritedModel to improve performance, see this pull in flutter for more info.
1.3.4
- NEW: Added
isValidHttpCodeinnum?extension that returns true if the http response code is 200 or 201. - NEW: Added
toDateWithFormatin a String extension that converts string toDateTimewith specific format e.g.,d-M-y.
Usage:
final dateTime = '14-12-2030'.toDateWithFormat('d-M-y');
final dateTime = '14-12-2030'.toDateWithFormat('d-M-y');1.3.3
- NEW: Added
binaryin bool extension that returns1if true and0if false asint.
1.3.2
- FIX: Fixed a bug when detecting
isIOSWebandisAndroidWebusingTargetPlatform. - NEW: Added
isApplethat detects if the running device is made by apple e.g. macOS, iPadOS, or iOS.
Usage:
context.isApple
// OR without context
defaultTargetPlatform.isApple // import 'package:flutter/foundation.dart';context.isApple
// OR without context
defaultTargetPlatform.isApple // import 'package:flutter/foundation.dart';1.3.1
- NEW: Added
toBoolto nullableObject?.
Rules:
- Object is true only if
- Object is bool and true.
- Object is num and is greater than zero.
- Object is string and is equal to 'yes', 'true', or '1'.
- any other conditions including null will return false.
1.3.0
- HOT FIX: I Fixed bool extension is not exported.
1.2.9
- NEW: Added
isTrue, andisFalseon nullable boolean, now if bool? is null the check will always return false instead of showing compile error.
1.2.8
- UPDATE: replace
isNegativeOrNull,isPositiveOrNull,isNotNegativeOrNull,isNotPositiveOrNull, andisNotZeroOrNullwith justisNegative,isPositive, andisZeroOrNullin nullable numbers.
1.2.7
- NEW: Added an option to check the device type when running on web, e.g.
isMobileWeborisDesktopWeb.
1.2.6
- NEW: Added
localgetter in datetime that call toLocal() on any dat, but it respects null safety.
1.2.5
- NEW: Added
tryRemoveAt,indexOfOrNull,indexWhereOrNull, andtryRemoveWhereonList<T>?extension. - UPDATE: Update the package to FlutterSDK 3.10.
- FIX: Fixed a bug with
isNotNullonObjectextension.
1.2.4
- NEW: Added
DatesHelperclass that provide a set of static methods for DateTime such asisSameHour,diffInDays, anddaysInRange. - NEW: Added the getters
isPresent,isPast,passedDuration,remainingDays, and more to theDateTimeextension.- Now you can get formatted date using the format method directly in any date e.g
DateTime.now().format('EEE')
- Now you can get formatted date using the format method directly in any date e.g
1.2.3
- NEW: Added
scaffoldMessengergetter in theBuildContextextension to easily callScaffoldMessenger.of(context) - UPDATE: Improved implementation of the
toListandtryToListin theConvertObjectclass.
1.2.2
- NEW: Added
toUtcIso(supports null safety) that convert any datetoUtc()andtoIso8601String()in the Date extensions.
1.2.1
- NEW: Added
isEmptyOrNullandisNotEmptyOrNullto Map and Set extensions.
1.2.0
- UPDATE: Update documentation.
1.1.9
- FIX: Fixed a bug with
isZerobool in numbers extensions. - UPDATE:
asBoolsupport null safety on numbers extensions. - UPDATE: Updated
ParsingExceptionimplementation.
1.1.8
- NEW: Added
isPositiveOrNull,isZeroOrNull, andisNegativeOrNullto all numbers extensions. - UPDATE: on a String extension,
isEmptyOrNullnow returns true if string has only empty lines.
1.1.7
- NEW: Added
toDateTimeandtryToDateTimeinConvertObjectclass.
1.1.6
- NEW: Added
toMapandtryToMapinConvertObjectclass, and addisValidSVGin a String extension.
1.1.5
- NEW: Added
toBoolandtryToBoolinConvertObjectclass. - UPDATE: Improved all implementations of static methods in
ConvertObjectclass.
1.1.4
- NEW: Supported converting timestamp milliseconds to
DateTimeand addedtryToStringinConvertObjectclass.
1.1.3
- FIX: Added missing
pushNamedAndRemoveUntilin the navigation extension.
1.1.2
- UPDATE: Improved
asBoolimplementation in the string extension.
1.1.1
- FIX: Fixed a bug in
camelCaseconversion algorithm.
1.1.0
- FIX: Fixed logo does not appear in readme file.
1.0.9
- UPDATE: Re-organized changelog and updated readme file.
1.0.8
- FIX: Fixed bug with
isHexColorin a color extension.
1.0.7
- NEW: Added new color extension to support converting hex string to color and checking if string is a hex color.
1.0.6
- UPDATE: Supported null safety to ThemeMode and Brightness.
1.0.5
- UPDATE: Changed
poptopopPageto solve conflicts withgo_routerpackage extensions.
1.0.4
- UPDATE: Updated readme file.
1.0.3
- NEW: Added
capitalizeFirstLetter,toPascalCase,toTitleCase, andtoCamelCaseto String extension.
1.0.2
- UPDATE: Renamed some getters to fix conflicts with the
getpackage.
1.0.1
- UPDATE: Updated readme file.
1.0.0
- INITIAL: Initial release.