hasan_utils 2.1.0
hasan_utils: ^2.1.0 copied to clipboard
A set of commonly used utilities for faster Flutter development.
2.1.0 - 2026-09-02 #
- New
ImagePickerHelper.pick(onPicked:): camera or gallery image picker (source: ImagePickerSource.camera, gallery by default) with an error alert; global defaults viaImagePickerHelper.options(maxWidth:, maxHeight:, imageQuality:)with per-call arguments taking precedence; translation keyspickers.image.titleandpickers.image.errors.unknown, overridable viaImagePickerHelper.translationKeys(title:, error:) - New
LoadingOverlay.show()/hide()/isShown: full-screen loading overlay with an optional context; customizeoverlayColor,indicator,text,textStyleandblockBackglobally viaLoadingOverlay.options(...)or per call; the user's back button is ignored while shown (on by default), while programmaticNavigation.goBack()still works - New
FileUtils.load()with the synchronousFileUtils.storagePath,FileUtils.privateStoragePath,FileUtils.tempPathandFileUtils.databasesPath - New
context.isRtlextension andColorUtils.fromHex(hex, fallback)supporting all CSS hex forms (#RGB,#RGBA,#RRGGBB,#RRGGBBAA, alpha last, hash optional) - New
AppInfo: app version info via package_info_plus;await AppInfo.load()once at startup, thenAppInfo.version,AppInfo.buildNumber,AppInfo.package,AppInfo.forApi()andAppInfo.shortAppVersion - New push notification engine: extend
PushNotificationsBaseand declaretopics,localizedTopics,targets,handlers(PushActionHandler) andalertBehavior(PushAlertBehavior); delta-synced topic subscriptions with automatic language re-sync,deviceTokenwithonTokenChanged, foreground/tapped dispatch viahandleMessageand a background-isolate lane viadispatchBackground - New
Navigation.popBlockers: back-button vetoes for routes pushed viaNavigation, used byLoadingOverlay - New
ScreenInsets: safe-area insets without a context (ScreenInsets.top/bottom/left/right) plus thewithSafeBottom()EdgeInsetsextension; setScreenInsets.value = MediaQuery.paddingOf(context)inMaterialApp.builder
2.0.0 - 2026-08-31 #
- Breaking:
Navigationmethods take the screen first and an optional namedcontext:Navigation.navigate(Screen()),Navigation.navigate(Screen(), context: context),Navigation.reset(Screen()),Navigation.goBack(),Navigation.closeDrawer(). Without a context they useNavigation.navigatorKey, which must be passed toMaterialApp.navigatorKey(seeNavigationScope).Navigation.openDrawer(context)still requires theScaffoldcontext - Breaking:
Navigation.goBack()andNavigation.closeDrawer()returnvoid, removeawaitfrom their calls - Breaking:
Alert.show(title, text, {context, buttonTitle, onPressed})andAlert.confirm(title, text, onPositive, {context, ...}):contextis an optional named argument that defaults to the navigator's context - Breaking:
Api.get/post/patch/delete(url, {context, ...}):contextis an optional named argument; the error alert uses the navigator's context when none is given and is skipped when there is no navigator - Breaking: default translation keys are
actions.ok,actions.cancel(Alert) anderrors.title(Apierror alert) instead of the top-levelok,cancelanderror. Keep the old keys withAlert.translationKeys(ok: 'ok', cancel: 'cancel')andApi.translationKeys(errorTitle: 'error') - New
NavigationScope(builder: (context) => MaterialApp(navigatorKey: Navigation.navigatorKey, ...)): creates a fresh navigator key every time the app is mounted, required when the whole app is rebuilt (e.g.LocalizationApp.reload()fromfast_localization2.0.0) - New
Navigation.context,Navigation.contextOf(context),Navigation.resetNavigatorKey(),Navigation.route(screen)andNavigation.goBack(result: value) - New
Alert.translationKeys(ok:, cancel:, close:)andApi.translationKeys(errorTitle:).closeis the single button ofAlert.show()and defaults took - New
Toast.show(text)with per-call and global options viaToast.options(length:, gravity:, backgroundColor:, textColor:, fontSize:); ownToastLength/ToastGravityenums (Android supports two lengths only; gravity is ignored by Android 11+ for native toasts) - New
InternetChecker: connectivity status singleton (ChangeNotifier) built onconnectivity_pluswithinit(),isConnected,subscribe/unsubscribeandlisten(context), moved from the apps (thesubscripe/unsubscripetypos are fixed) - New migration tool:
dart run hasan_utils:migrate_v2 lib [--dry-run] [--drop-context] [--force]rewrites 1.x call sites - Breaking: uses
package:material_uiinstead ofpackage:flutter/material.dart, so it requires Flutter 3.44+ / Dart 3.12+ and an app built onmaterial_ui(dart fix --apply --code=migrate_design_widgets); noMaterialUiCompatibilityBridgeneeded - Breaking: requires
fast_localization2.0.0 - Breaking:
Api.get/post/patch/deletereturnFuture<void>instead ofdynamic; the response only flows throughonSuccess, soawaitworks as before but the result can no longer be assigned to a value - Breaking: removed the unused
versionparameter fromLocalPersistenceandJsonPersistence; both constructors are nowconst - Fixed
Api.authorizationHeaderthrowingtype 'Null' is not a subtype of type 'String'when no authorization is set; it returns an empty map instead Validate.message/Validate.lengthstypes renamed toValidateMessages/ValidateLengthsinternally; they are accessible only throughValidate.messageandValidate.lengthsPersistenceis amixin class, soclass User with ChangeNotifier, Persistencekeeps working under Dart 3- Upgrade guide: MIGRATION.md
1.2.4 - 2026-02-27 #
- Api: Only send
FormDatabody whenparamsis provided and non-empty
1.2.3 - 2026-02-19 #
- Api: Added
httpClientAdaptertoApi.options()
1.2.2 - 2025-01-18 #
- Persistence:
get()now falls back toengine.datadefaults when a key doesn't exist in saved data
1.2.1 - 2025-12-08 #
- Api: Support onError: (ApiErrorException) {} in addition to the default () {}
- Api: Enhance error JSON parsing in onError
- Api: Support a new error JSON format {"error": {"message": "Complex"}} in addition to {"error": "Simple"}.
1.2.0 - 2025-01-09 #
- Upgrade Dio package from v4 to v5
1.1.2 - 2023-08-31 #
- Api: Accept and force API response to be a JSON list or object.
- Upgrade packages
1.1.1 - 2023-04-04 #
- Api: Added
timeouttoApi.options()
1.1.0 - 2021-12-29 #
- Api: Added interceptors to
Api.options() - Upgraded dependencies
1.0.3 - 2021-10-21 #
- Storage: Added
repload()
1.0.2 - 2021-10-17 #
- Api: Fixed sending
Listinparams
1.0.1 - 2021-04-04 #
- Navigation: Add
replace()
1.0.0 - 2021-04-01 #
- Null safety support
0.4.5 - 2020-11-30 #
- Api: Add
authorizationHeaderto get authorization's header ({'Authorization': '...'})
0.4.4 - 2020-11-18 #
- FileDownloader: Fully asynchronize
start()
0.4.3 - 2020-11-18 #
- FileDownloader: Make
start()returnFuture
0.4.2 - 2020-10-25 #
- Storage: Added
setInt(),setDouble(),setBool()
0.4.1 - 2020-10-21 #
- Api: Ensure
onFinish()is called afteronSuccess()
0.4.0 - 2020-09-29 #
- Api: Upload MultiPart files.
0.3.0 - 2020-09-17 #
- Updated dependencies.
- Fixed Api debug error response.
0.2.0 - 2020-08-30 #
- Fixed
FormatExceptionthat is thrown when anApirequest expects JSON output but response returns string instead.
0.1.0 - 2020-08-26 #
- Initial release.