flutter_helper_utils 8.5.0
flutter_helper_utils: ^8.5.0 copied to clipboard
The Flutter Helper Utils Package offers various extensions and helper methods that can make development more efficient.
CHANGELOG #
8.5.0 #
Breaking #
TypedListViewBuildernow uses theitemBuilder(context, index, item)signature for idiomatic Flutter access toBuildContext.
Added #
- New list quality-of-life options:
spacing,emptyBuilder,showScrollbar, and pull-to-refresh support. - Infinite scroll helpers via
onEndReached,onEndReachedThreshold, andisLoadingMore. itemKeyBuilderfor stable keyed items when combining headers, separators, or pagination widgets.- Introduced
TypedSliverListwith matching builder ergonomics forCustomScrollViewusage.
Changed #
- Simplified header/footer/pagination configuration on
TypedListView, replacingheaderBuilder/footerBuilderwith direct widget slots.
8.4.0 #
- Add color lookup by name to ColorScheme extensions
8.3.0 #
- Enhanced ParsingException to provide comprehensive debugging information with structured argument maps and filtered output.
- CHORE: updated the dart_helper_utils to be ">=5.4.0 <6.0.0".
8.2.0 #
Added #
-
Added missing
ColorSchemeproperties toThemeDataextension includingprimaryFixed,primaryFixedDim,onPrimaryFixed,onPrimaryFixedVariant,secondaryFixed,secondaryFixedDim,onSecondaryFixed,onSecondaryFixedVariant,tertiaryFixed,tertiaryFixedDim,onTertiaryFixed,onTertiaryFixedVariant,surfaceDim,surfaceBright,surfaceContainerLowest,surfaceContainerLow,surfaceContainer, andsurfaceContainerHigh. -
CHORE: updated the dart_helper_utils to be ">=5.3.0 <6.0.0".
8.1.0 #
Added #
- Color Conversion Utilities: Added
toColor()andtryToColor()for robustly parsing colors from strings (Hex, CSS functions), integers, and other color types. - Color Harmony Generation: Added methods to generate theory-based color palettes:
monochromatic(),analogous(),triadic(),tetradic(), andsplitComplementary(). - WCAG Accessibility Suite:
meetsWCAG(): Checks color contrast against AA/AAA standards.suggestAccessibleColors(): Provides accessible color alternatives for a given background.
- Color Blindness Simulation:
simulateColorBlindness(): Simulates how colors appear with various vision deficiencies.isDistinguishableFor(): Checks if two colors have enough contrast for colorblind users.
Changed #
- API Clarity: Renamed all
add*color methods toset*(e.g.,addOpacitytosetOpacity) for clearer intent. Old methods are now deprecated and will be removed in v9.0. - CSS Compliance: HSL color parser now correctly handles hue angle wrapping as per the CSS Color Module Level 4 specification.
8.0.2 #
- Updated docs
- Enhanced
MultiTapDetectorwidget. - Deprecated gradientAlignment parameter from the
GradientWidget. Use the gradient's own positioning properties instead (like begin/end for LinearGradient).
8.0.1 #
- CHORE: updated the dart_helper_utils to be ">=4.1.2 <6.0.0" for more flexibility.
8.0.0 #
New Features #
- Added
toEnumtoTextDirectionin theintlmodule:- This utility converts the
TextDirectiontype from theintllibrary to the correspondingTextDirectionenum from the Material library. - Solves type compatibility issues, such as "The argument type 'TextDirection' can't be assigned to the parameter type 'TextDirection?'". For example, use
TextDirection.RTL.toEnumdirectly in anyTextwidget to ensure seamless integration.
- This utility converts the
Breaking Changes #
-
Relocation of
SingleAxisWrapwidget:- The
SingleAxisWrapwidget has been extracted into a standalone package: single_axis_wrap. - This move includes several enhancements to the widget’s functionality.
- Refer to the migration guide for instructions on updating your code.
- The
-
Dependency Update:
dart_helper_utilsupgraded to v5.0.0:- This update introduces breaking changes from the
dart_helper_utilspackage. - Key changes include:
- Removal of conversion helpers on
Objectto reduce IDE suggestion clutter. - Renaming of
DateTimeextension methods (e.g.,addOrRemoveYears→addOrSubtractYears). - New date manipulation methods and improved precision (e.g., millisecond/microsecond support).
- Removal of conversion helpers on
- For a full list of changes, see the dart_helper_utils v5.0.0 changelog.
- This update introduces breaking changes from the
7.0.0 #
Features & Enhances #
New Locale & Directionality Utilities
- Added convenient RTL/LTR direction checking utilities
- Added rich context helpers for:
- Directionality management (
directionality,isLTR,isRTL) - Locale access and formatting (
locale,localeString,languageCode) - Language, script, and country code validation.
- Directionality management (
- Added direction-aware layout utilities:
- Logical padding and margin helpers.
- RTL-aware alignment and positioning.
- Direction-sensitive offsets and sizing.
- Added common language detection (Arabic, English, Persian, etc.)
- Added utilities for RTL-aware list ordering and manipulation.
CarouselController Extension
- Added an extension on
CarouselControllerwith utilities for controlling carousel behavior.- Supports both fixed and weighted item extents.
- Includes methods to animate or jump to items, move next/previous, and navigate by a relative number of items.
- Wraps indices for seamless looping.
- Supports rounding modes (
round,floor,ceil) and snapping behavior. - Moves based on scroll velocity for smoother interactions.
- Allows overriding default calculations for more flexibility.
Widget
- Added
SingleAxisWrap: Adaptive single-axis layout that automatically switches between row and column based on available space- Unlike
Wrap, maintains all children in the same axis (no wrapping to new lines/columns) - Configurable preferred direction with automatic fallback
- Independent row/column configurations for spacing and alignment
- Unlike
Theme
- Added new
themeExtensionwhich returns a custom theme extension of typeTfrom the nearestThemeancestor. - Added new
themeWithExtensionwhich Returns a tuple containing theThemeDataand a custom theme extension of typeT.
Colors
-
Color Utilities
- Added
contrastColorfor generating readable contrasting colors - Added
isDarkandisLightfor WCAG-based color analysis - Enhanced grayscale conversion using linear luminance for better perceptual accuracy
- Added
isApproximatelyfor fuzzy color comparison with tolerance
- Added
-
String to Color Parsing this version improves handling of hex colors, alpha channels, RGB percentages, and multiple angle units in HSL, using robust methods for accuracy.
-
Added support for modern color formats:
- RGB/RGBA:
rgb(255, 0, 0),rgba(255, 0, 0, 0.5) - HSL/HSLA:
hsl(120, 100%, 50%),hsla(120, 100%, 50%, 0.5) - HWB:
hwb(0 0% 0%),hwb(0 0% 0% / 0.5) - Modern space-separated syntax
- CSS named colors
- RGB/RGBA:
-
Enhanced validation methods:
isValidColor: Universal color format validationisHexColor: Improved hex color validationisRgbColor: RGB/RGBA syntax validationisHslColor: HSL/HSLA syntax validationisModernColor: Modern color function syntax validation
-
New Scroll Extensions Helpers
- Added:
flingWithVelocity- Performs velocity-based scroll animation - Added:
snapToClosest- Snaps scroll position to the closest item based on a given item extent - Added:
scrollByPercentage- Scrolls by relative percentage from current position - Added:
isItemVisible- Checks if a specific item is visible in viewport - Added:
hasScrollMomentum- Checks if scroll view is in ballistic scroll motion - Added:
debugPrintScrollInfo- Prints detailed scroll state information for debugging
Platform Environment
- Added
report()method toPlatformEnv- Returns: Detailed platform information in
Map<String, String>format
- Returns: Detailed platform information in
Breaking Changes Guide #
Focus Scope Extension Updates
All getter methods have been converted to regular method calls for clarity:
| Old (Getter) | New (Method) |
|---|---|
unFocus |
unFocus() |
requestFocus |
requestFocus() |
Scaffold Messenger Extension Updates
All getter methods have been converted to regular method calls:
| Old (Getter) | New (Method) |
|---|---|
hideCurrentMaterialBanner |
hideCurrentMaterialBanner() |
hideCurrentSnackBar |
hideCurrentSnackBar() |
removeCurrentMaterialBanner |
removeCurrentMaterialBanner() |
removeCurrentSnackBar |
removeCurrentSnackBar() |
clearMaterialBanners |
clearMaterialBanners() |
clearSnackBars |
clearSnackBars() |
Scroll Extensions Changes
- Renamed:
isInTop→isAtTopfor better naming consistency - Important: The extension no longer supports nullable scroll controllers
- All helper getters now require null-aware access (e.g.,
controller?.isAtTop)
- All helper getters now require null-aware access (e.g.,
Dependencies #
- Updated to
dart_helper_utilsv4.0.0 (contains breaking changes)- For details: dart_helper_utils changelog
- Flutter SDK: Enforced minimum version to
>=3.29.0.
6.10.0 #
New Scroll Extensions: #
- Extended ScrollController Functionality:
- Basic Scroll Animations:
animateToPosition: Animate to a specific offset with customizable duration and curveanimateToBottom/animateToTop: Quick navigation to extremessmoothScrollTo: Smooth scroll with boundary clamping
- Advanced Controls:
pageScroll: Paginated scrolling with a customizable viewport fractionscrollToPercentage: Scroll to specific percentage of content
- Position Checking:
isAtEdge,isAtBottom: Edge detectionscrollProgress: Current scroll position as percentageisNearTop/isNearBottom: Proximity detection with a threshold
- Basic Scroll Animations:
- Nullable ScrollController Extensions:
isInTop: Check if scrolled to topcanScroll: Verify if scrolling is possibledidScrollToTop: Animate to top and return success status- Direction Checking:
isScrollReverse/isScrollForward/isScrollIdle: Direction state checks
- ScrollDirection Extensions:
- Simple direction state checks:
isIdle,isForward,isReverse
- Simple direction state checks:
6.9.0 #
Colors Enhancements: #
- Wide Gamut Support: Updated all color operations to be compatible with Flutter's new wide gamut color support.
This includes using the
Color.withValuesconstructor and ensuring sRGB alignment for consistent results. - Migration Helpers: Added methods to assist with migrating from the old
ColorAPI to the new one:addOpacity(double opacity): ReplaceswithOpacity.addAlpha(int alpha): ReplaceswithAlpha.addRed(int red): ReplaceswithRed, and similar foraddGreen/addBlue.toARGBInt(): Converts to the old 32-bit integer format.lerpColor(Color? a, Color? b, double t): sRGB-aware version ofColor.lerp.
- Additional Functionality:
scaleOpacity(double scale): Scales the alpha channel.convertToColorSpace(ColorSpace targetSpace): Converts to a specific color space.isInColorSpace(ColorSpace targetSpace): Checks the color's color space.
Internal Improvements: #
- sRGB Alignment: Improved handling of color spaces, ensuring that operations like HSL transformations and luminance calculations are performed in the sRGB color space for consistency.
- Code Clarity: Refactored some methods for better readability and maintainability.
Chore: #
- Flutter SDK: Enforced minimum version to
>=3.27.0. - dart_helper_utils: Upgraded to v3.3.0.
6.8.0 #
- Easier theme color access: Access ColorScheme properties directly from the theme data object.
For example, use
theme.onSurfaceinstead oftheme.colorScheme.onSurface.
6.7.1 #
- Enhancement:
TypedListView's internal logic for rendering items and separators has been optimized. - Chore:
dart_helper_utilupgraded to v3.1.1.
6.7.0 #
New: TypedListView Widget #
- A type-safe list view for building highly customizable list.
- Supports optional headers, footers, separators, and pagination.
- Optimized for performance with efficient item building logic.
-
TypedListView( items: products, itemBuilder: (index, product) => ProductCard(product: item) paginationWidget: const CircularProgressIndicator(), padding: 8.edgeInsetsAll, ),
Future<T> Extensions #
-
builder: Simplifies creatingFutureBuilderwidgets with less boilerplate.- Handles
Futurestates (loading, data, error) and supportsinitialDatafor pre-load UI.
- Handles
-
map: TransformsFutureresults with a specified function.- Returns a new
Futurewith the transformed result, enabling easier async chaining.
- Returns a new
-
buildWidget: Simplifies building widgets based onFuturestates.- Accepts
onSuccess,onError, and optionalonLoadingcallbacks for rendering different states.
- Accepts
AsyncSnapshot<T> Extensions #
-
Connection State Getters:
isNone,isWaiting,isActive,isDone,isSuccess,hasErrorAndDone,isWaitingOrActive.
-
Data Utility Methods:
dataOr: Provides safe access to data with a default fallback.dataWhen: Pattern-matching utility for handling different snapshot states.buildWidget: Simplifies widget building withonSuccess,onError, andonLoadingcallbacks.mapData: Transforms data if available, returningnullotherwise.
// Using the `buildWidget` extension on Future to build UI for different states fetchData().buildWidget( onSuccess: (context, data) => ContentWidget(data), onError: (context, error) => ErrorWidget(error), onLoading: (context) => LoadingWidget(), ); -
Added Countries search example which uses the lightweight countries and timezone data from the
dart_helper_utilpackage v3.0.0+. -
dart_helper_utilupgraded to v3.0.0.
6.6.0 #
dart_helper_utilupgraded to v2.6.0. This includes updates toDoublyLinkedListmethods, which are now re-implemented in theDoublyLinkedListNotifier.- Added the following to the BuildContext extension for MediaQuery:
nullableDeviceOrientationnullablePixelRationullableTextScalerplatformBrightnessnullableSystemGestureInsetsnullableViewPaddingalwaysUse24HourFormataccessibleNavigationinvertColorshighContrastonOffSwitchLabelsdisableAnimationsboldTextgestureSettingsdisplayFeaturessupportsShowingSystemContextMenunullableSupportsShowingSystemContextMenu- Usage example:
@override Widget build(BuildContext context) { // DO final displayFeatures = context.displayFeatures; // INSTEAD OF final displayFeatures = MediaQuery.displayFeaturesOf(context); }
- Usage example:
6.5.1 #
The MultiTapDetector widget has been enhanced to handle rapid tapping scenarios and prevent accidental triggers.
6.5.0 #
- Added
GradientWidgetwhich applies a gradient effect to its child widget.
- Updated
dart_helper_utilto v2.5.3.
6.4.0 #
- Added more methods on numbers for creating
Border,Matrix4, andBoxConstraints. - Added
MultiTapDetectorwidget for detecting multi-tap gestures onchildwithtapCountandonTapcallback.
- Updated
dart_helper_utilto v2.5.2.
6.3.0 #
- Added new methods on numbers for creating
BorderRadiusandRadiuswith specific corner combinations:onlyTopRoundedonlyBottomRoundeddiagonalBLTRdiagonalTLBRonlyLeftRoundedonlyRightRounded
Container
(
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: 10.allCircular, // All corners rounded with radius 10
),
...
),
This changelog focuses on the most impactful changes, making it easy for users to quickly understand the updates to the extension.
6.2.0 #
Introducing Adaptive UI: #
This update introduces a set of tools for creating adaptive user interfaces using only native Flutter code. Widgets update efficiently, triggered only by platform type changes not on every pixel change like other APIs.
Key Highlights:
PlatformTypeProviderWidget: Detect platform type (mobile, tablet, desktop, etc.) and manage breakpoint changes efficiently.- Context Extensions:
- Use
context.breakpointandcontext.platformSizeInfofor convenient access to platform and orientation information. - You can now access the platform helper directly from the theme, e.g.,
theme.isMobile.
- Use
- Responsive Layout Builders:
BreakpointLayoutBuilder: Build responsive layouts based on the current breakpoint (e.g., mobile, tablet).PlatformInfoLayoutBuilder: Build responsive layouts based on both platform type and screen orientation.
- Detailed Documentation: Added detailed documentation for adaptive UI usage.
New Features: #
- Extension Methods for
num:paddingAll,paddingHorizontal,paddingTop, etc.: CreatePaddingwidgets directly from numeric values, e.g.,12.paddingAll().edgeInsetsAll,edgeInsetsHorizontal,edgeInsetsTop, etc.: GenerateEdgeInsetsobjects from numeric values for padding control, e.g.,padding: 12.edgeInsetsAll.widthBox,heightBox,squareBox: Easily createSizedBoxwidgets with specified dimensions.size: Converts a numeric value into aSizeobject.
- Extension Methods for
Size:toSizedBox: Transforms aSizeobject into aSizedBox.scaled: Scales aSizeby a given factor.aspectRatio: Calculates the aspect ratio of aSize.withWidth,withHeight: Creates a newSizewith a modified width or height.transpose: Swaps the width and height of aSize.toPadding: Converts aSizeinto aPaddingwidget.toAspectRatio: Creates anAspectRatiowidget from aSize's aspect ratio.isEmpty: Checks if aSizehas zero width and height.isLargerThan,isSmallerThan: Compares the area of twoSizeobjects.scaleIndependently: Scales the width and height of aSizeindependently.clamp: Restricts aSizewithin specified minimum and maximum dimensions.expand,reduce: Increases or decreases the dimensions of aSize.maxDimension,minDimension: Retrieves the largest or smallest dimension of aSize.isEqualTo: Compares twoSizeobjects for equality.increaseBy,decreaseBy: Creates a newSizewith increased or decreased dimensions.fitWithin: Scales aSizeto fit within specified constraints while maintaining its aspect ratio.
Fixes #
- Fixed a typo in the
setDarkmethod; it was previously misspelled assetDart. - Removed the custom
Boxwidget asSizedBox.squareprovides similar functionality.
6.1.0 #
-
Introduced
isFuchsiaandisFuchsiaWebproperties toBuildContextandTargetPlatformextensions, simplifying detection of the Fuchsia operating system in both native and web environments. -
Added
DoublyLinkedListNotifierwhich createsValueNotifier<DoublyLinkedList>(leveraging theDoublyLinkedListfromdart_helper_utilspackage as of v2.2.1+) -
Create custom
ValueNotifier(e.g.ListNotifier) from anyIterable<E>using thelistNotifier,setNotifier, anddoublyLinkedListNotifierconstructors. -
EdgeInsetsConversion: convert numbers toEdgeInsetsusing the new extension, e.g.,Padding(padding: 8.paddingAll). -
themeData.withoutEffects(): method to customize which visual feedback effects (splash, highlight, hover, etc.) to remove from a theme. -
ThemeWithoutEffectsWidget: Wrap widgets with this widget to selectively disable visual effects for specific parts of your app. -
PlatformEnv:
- Introduced the
PlatformEnvclass to replace direct usage ofdart:io'sPlatformfor improved web compatibility and error prevention. - The
PlatformEnvclass is a critical update for web compatibility. Consider updating your code to usePlatformEnvinstead ofPlatformfor a smoother transition to web support.
- Introduced the
-
Enhanced Color Extension:
- Expanded
toHex: ThetoHexmethod now accepts an optionalincludeAlphaparameter to control whether the alpha channel is included in the hexadecimal representation. - Introduced new methods:
darken,lighten: Adjust color lightness.shade,tint: Create variations by mixing with black/white.contrast: Calculate contrast ratios between colors.complementary: Find the opposite color on the color wheel.blend: Mix colors.grayscale,invert: Convert to grayscale or invert colors.
- Expanded
6.0.3 #
- Updated some documentation.
6.0.2 #
Breaking Changes #
- Renamed Method: The
listenableBuildermethod has been renamed tobuilderin theextension on ValueListenable. - Refactored Notifier Classes: Methods previously available as extensions on ValueNotifier
New Features #
- Introduced
ListenablesBuilder: A widget for building UI in response to changes in multiple listenable objects (List<Listenable>). it also hasbuildWhenandthresholdproperties for more granular control over rebuild behavior. - Listenable Extensions: Added
buildermethods to easily createListenableBuilder(for single listeners) andListenablesBuilder(for multiple listeners) widgets.
Fixes & Enhancements #
- Updated
dart_helper_utilto v2.1.0. - Fixed custom notifier classes sometimes produce Stackoverflow bug when notify listeners.
Migration Guide #
- Updating ValueNotifier Extensions:
- Replace all instances of
listenableBuilderwith the newbuildermethod to ensure compatibility.- Before:
final myNotifier = ValueNotifier<int>(0); myNotifier.listenableBuilder( (value) => Text('Value is $value'), ); - After:
final myNotifier = ValueNotifier<int>(0); myNotifier.builder( (value) => Text('Value is $value'), );
- Before:
- Replace all instances of
5.0.0 #
Changed #
- Upgraded
dart_helper_utilsto v2.0.0, introducing breaking changes. - Enhanced and moved all
isEqualmethods (Map, Set, List, global) todart_helper_utils.
BREAKING CHANGES #
- The
dart_helper_utilsv2.0.0 upgrade introduces breaking changes. Review the changelog for detailed information and update your code accordingly.
4.4.0 #
-
Added
copymethods to all TextStyle properties in ThemeData (e.g.,displayLargeCopy,headlineMediumCopy, etc.). This allows quickly using copyWith on text style with minimal code, for example, Usetheme.displayLargeCopy(color: Colors.red)instead oftheme.displayLarge?.copyWith(color: Colors.red) -
Added
refreshmethod to all specialized notifiers to allow forcenotifyListenerswithout changing value ofValueNotifier. -
Updated
dart_helper_utilto v1.2.0.
4.3.0 #
-
Added
setDart,setLight, andsetSystemtoBrightnessNotifier, andThemeModeNotifier. -
Added
modalRoute()to the context extension for convenient access to the current ModalRoute. -
Added the
usePopUntilparameter to thecontext.dismissActivePopup(default:true):- If
true, usespopUntilfor efficient dismissal of multiple pop-ups. - If
false, usesrecursion(might be necessary for compatibility reasons). - This provides flexibility for different navigation scenarios and compatibility needs.
- If
-
Updated
dart_helper_utilto v1.1.0.
4.2.0 #
- Enhancement to the
context.dismissActivePopup().
4.1.1 #
- Updated the README
4.1.0 #
Introducing dart_helper_utils #
We've refactored the Dart-specific utilities into a new
package, dart_helper_utils, to allow Dart projects to use these
utilities without depending on Flutter.
- No changes are necessary from your side as
flutter_helper_utilsnow exportsdart_helper_utilsinternally.
New Features: #
- BrightnessNotifier and ThemeModeNotifier for easy creation of
ValueNotifierinstances. - New extensions on
ThemeDatafor quick access to common text styles (theme.bodySmall) and brightness checks (isDark,isLight).
NOTES:
- All the Dart-specific utilities documentations moved to
the
dart_helper_utilsreadme. - Future updates for Dart-specific utilities will be available in
the
dart_helper_utilschangelog. - Do NOT use the older versions (under 4.1.0) of this package
with
dart_helper_utilsas it may conflict with it.
4.0.1 #
- Fixed mime checks aren't exported.
4.0.0 #
New Features #
- JSON Handling
- Encoding: Easily encode any object to JSON using the new
.encode()method on any object. - Decoding: Decode JSON effortlessly with the
.decode()method on String, e.g."[1,3,4]".decode();.
- Encoding: Easily encode any object to JSON using the new
- ValueNotifier Helpers
- A comprehensive suite of tools for working with
ValueNotifier- Specialized Notifiers: Type-safe notifiers like
BoolNotifier,IntNotifier, and more. .notifierExtension: Quickly create notifiers from various types.- Enhanced Functionality: Added extension methods like
toggle,round, andincrementtoValueNotifiersubclasses. - Reactive Integration: Easily convert
ValueNotifierinto aStreamwith thestreamextension. - Concise UI Building: The
.listenableBuilderextension offers a shorter and more readable syntax compared to the traditionalValueListenableBuilder.
- Specialized Notifiers: Type-safe notifiers like
- A comprehensive suite of tools for working with
Enhancements #
-
Map Extension Improvements:
-
BREAKING CHANGE: Removed global functions
formattedJsonStringandmakeMapEncodable. Introduced more intuitively named methods within a Map extension:makeEncodable,safelyEncodedJson, andencodedJsonforMap<K, V>types.Migration Guide:
final myMap = { ... }; // BEFORE: makeMapEncodable(myMap); formattedJsonString(myMap); // NOW: myMap.makeEncodable; myMap.safelyEncodedJson;
-
-
MIME Type Checks on String:
- BREAKING CHANGE: Replaced
isValidVideo,isValidHTML,isValidAudio,isValidImage, andisValidSVGwith more streamlined methods:isVideo,isHTML,isAudio,isImage, andisSVG. - Added a new
mimeType()function that returns the MIME type for any given file path or URL, e.g.,'path.mp4'.mimeType()returns'video/mp4'. - Introduced new getters for various file types, enhancing the way file types are detected based on file paths or
URLs.
- These include checks for:
- Videos:
isVideo,isMP4,isMOV, etc. - Images:
isImage,isPNG,isJPEG, etc. - Documents:
isPDF,isDOCX,isTXT, etc. - Audio:
isAudio,isMP3,isWAV, etc. - Archives:
isArchive,isZIP,isRAR, etc. - And more, allowing for straightforward usage like
'file.mp4'.isMP4returningtrue.
- Videos:
- These include checks for:
- BREAKING CHANGE: Replaced
Breaking Changes Summary #
- Removed
formattedJsonStringandmakeMapEncodablein favor of new methods within the Map extension. - Replaced various
isValidMIME type checks with simpler and more intuitiveismethods, e.g.isValidVideo -> isVideo
3.1.0 #
- UPDATE: Updated
asBoolin the objects.
3.0.7 #
- NEW: Added
getRandomthat can be used with any number to get random number from it.final random = 1000.getRandom;
3.0.6 #
- IMPORTANT fix to for the convert objects helper and static methods which makes the app freeze, if you are at '3.0.4' or '3.0.5,' I encourage you to upgrade.
3.0.5 #
- Added isEqual to the
Set,List,Map, and as global method.
3.0.4 #
- The
asGreeksis no longer a getter, it's a function now that takes optionalfractionDigitswhich lets you specify number of digits after the decimal point in the generated greek number. (asGreeksused to Convert a number to a format that includes Greek symbols for thousands, millions, and beyond. e.g. '1000' asGreek is '1k')
3.0.3 #
NEW:
-
Introduced
formattedJsonStringglobal function for converting maps to a formatted/indented JSON strings, ensuring compatibility with complex types and ready to be used in logs output files. -
Added new
localoptional argument to thetoDateTimeandtryToDateTimein both the static and global functions.
3.0.2 #
- UPDATE: Update docs for README, all ConvertObject's static methods, and add docs to all global functions.
3.0.0 #
-
BREAKING CHANGE:
-
NEW FEATURE:
- Added new
toUriandtryToUriin both theConvertObjectclass and the global functions. - Introducing a new getter
domainNamein theUriextension.
- Added new
-
ENHANCEMENTS: The
indexOfOrNullmethod under Iterable Extensions now supports taking null values.
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);
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 packages -
UPDATE: 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());
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 1,000,000,000 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
- 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
1.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: 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: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.6 #
- 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');
1.3.5 #
- NEW: Added
binaryin bool extension that returns1if true and0if false asint.
1.3.4 #
- NEW: Added
tryRemoveAt,indexOfOrNull,indexWhereOrNull, andtryRemoveWhereonList<T>?extension. - UPDATE: Update the package to FlutterSDK 3.10.
- FIX: Fixed a bug with
isNotNullonObjectextension.
1.3.3 #
- 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.3.2 #
- NEW: Added
scaffoldMessengergetter in theBuildContextextension to easily callScaffoldMessenger.of(context) - UPDATE: Improved implementation of the
toListandtryToListin theConvertObjectclass.
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: A fixed bool extension is not exported.
1.2.9 #
- FIX: Fixed a bug with
isZerobool in numbers extensions. - UPDATE:
asBoolsupport null safety on numbers extensions. - UPDATE: Updated
ParsingExceptionimplementation.
1.2.8 #
- NEW: Added
isPositiveOrNull,isZeroOrNull, andisNegativeOrNullto all numbers extensions. - UPDATE: on a String extension,
isEmptyOrNullnow returns true if string has only empty lines.
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 with thegetpackage.
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.