smart_executer 2.2.2
smart_executer: ^2.2.2 copied to clipboard
A powerful Flutter package for executing async operations with built-in error handling, loading dialogs, retry logic, and Result pattern support.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.2.2 - 2026-03-18 #
Added #
defaultViewTypeinSmartExecuterConfig.initialize()— set the defaultErrorViewTypefor all operations globally- Defaults to
ErrorViewType.snackBar - Per-operation
viewTypeoverrides the global default - Resolution: per-operation
viewType→config.defaultViewType
- Defaults to
Changed #
viewTypeparameter inexecute(),run(),inBackground(),runStream(),inBackgroundStream()is now optional (ErrorViewType?) — if omitted, falls back toconfig.defaultViewType
2.2.1 - 2026-03-11 #
Changed #
- BREAKING:
MessageBuildertypedef changed fromString Function()toString Function(BuildContext context)- Message functions now receive the
BuildContextfor proper localization support - Migrate:
defaultErrorMessage: () => 'msg'→defaultErrorMessage: (_) => 'msg' - Localization example:
noConnectionMessage: (context) => AppLocalizations.of(context)!.noConnection - Config accessors changed from getters to methods:
config.noConnectionMessage→config.noConnectionMessage(context)
- Message functions now receive the
2.2.0 - 2026-03-11 #
Changed #
- BREAKING:
defaultErrorMessage,noConnectionMessage,sessionExpiredTitle,sessionExpiredMessageinSmartExecuterConfig.initialize()are nowString Function()(MessageBuilder) instead ofString- Enables dynamic / localized messages resolved at the time the error occurs
- Migrate:
defaultErrorMessage: 'msg'→defaultErrorMessage: () => 'msg' - Localization example:
noConnectionMessage: () => AppLocalizations.of(ctx)!.noConnection - Getters (
config.noConnectionMessage, etc.) still returnString— no changes needed in call sites
Added #
MessageBuildertypedef (String Function()) — new type alias used by the four message fields above
2.1.0 - 2026-03-05 #
Added #
-
Per-Operation Error Builders: Override global error builders on a per-call basis
- Added optional
snackBarErrorBuilderparameter toexecute(),run(),inBackground(),runStream(),inBackgroundStream() - Added optional
dialogErrorBuilderparameter toexecute(),run(),inBackground(),runStream(),inBackgroundStream() - Per-operation builders take priority over global config: operation builder → global config → package default
- Useful for operations that need unique error presentation without changing global configuration
- Added optional
-
SmartExceptionType enhanced enum: Added
colorandiconfields toSmartExceptionType- Each exception type now carries its own
ColorandIconData - Simplifies building custom error UIs:
exception.exceptionType.color,exception.exceptionType.icon
- Each exception type now carries its own
-
Example Pages: New interactive example pages for error builders
- SnackBar Error Builder page with per-type trigger demos
- Dialog Error Builder page with per-type trigger demos
- Per-operation builder override demonstration
- Toggle between default and custom builders
- Configuration code previews
2.0.0 - 2025-03-05 #
Added #
-
Error Builders: New per-exception-type error builder system
SnackBarErrorBuilder- Configure custom SnackBars for each exception typeDialogErrorBuilder- Configure custom Dialogs for each exception type- Both support:
baseBuilder, per-type builders (connectionBuilder,connectionTimeoutBuilder,sendTimeoutBuilder,receiveTimeoutBuilder,cancelledBuilder,responseBuilder,sessionExpiredBuilder), andcustomBuilderfor unknown types - All builders receive full
SmartExceptionwithExceptionMetadata
-
Error View Types: New
ErrorViewTypeenum (snackBar,dialog)- Added
viewTypeparameter torun(),inBackground(),runStream(),inBackgroundStream() - Added optional
contextandviewTypetoexecute()for visual error display - Default view type is
ErrorViewType.snackBar
- Added
-
SmartErrorDialog: New default error dialog widget
- Modern Material 3 design with colored icon circle
- Per-exception-type icons, colors, and titles
- Rounded corners with styled action button
-
SmartExceptionType enum: New
SmartExceptionTypeenum for convenient exception type identification- Each
SmartExceptionsubclass now has anexceptionTypegetter - Enables simple type checking without pattern matching:
exception.exceptionType == SmartExceptionType.connection
- Each
-
Enhanced SmartErrorSnackBar: Upgraded default design
- Distinct icons per error type (
wifi_off,timer_off,upload,download,cancel,cloud_off,lock_outline,error_outline) - Improved rounded corners and elevation
- Distinct icons per error type (
Changed #
- BREAKING:
SmartExecuterConfig.initialize()now usessnackBarErrorBuilder(typeSnackBarErrorBuilder) anddialogErrorBuilder(typeDialogErrorBuilder) instead oferrorSnackBarBuilder(typeErrorSnackBarBuilder) - BREAKING: Removed
ErrorSnackBarBuildertypedef from config
Removed #
- BREAKING: Removed auto-retry mechanism entirely
- Removed
maxRetriesandretryDelayfromSmartExecuterConfig.initialize() - Removed
maxRetriesandretryDelayfromExecuterOptions - Removed retry loop from
SmartExecuter.execute()
- Removed
1.4.0 - 2025-01-01 #
Added #
-
Real-World Integration Scenarios: Example app now includes comprehensive scenarios demonstrating integration with Genius Systems packages:
- User List Scenario: SmartPagination + SmartExecuter for paginated lists with error handling
- Form Submit Scenario: SuperDialog + SmartExecuter for form workflows with confirmation dialogs
- Product Cards Scenario: TooltipCard + SmartExecuter for interactive product cards
- Full Integration Scenario: Complete task dashboard combining all packages
-
New Dependencies (example app):
smart_pagination: ^2.5.0- Paginated lists with BLoCsuper_dialog: ^0.3.0- Animated dialogstooltip_card: ^2.6.1- Interactive tooltips
Changed #
- Enhanced example app with Real-World Scenarios section on home page
- Added scenarios folder with integration examples
- Improved documentation with code previews
1.3.0 - 2024-01-01 #
Added #
-
Status Cards Customization: Full widget customization support
titleWidget- Custom widget for title (overridestitletext)bodyWidget- Custom widget for body (overridesmessagetext)actionsWidget- Custom widget for actions (overridesaction/secondaryAction)iconWidget- Custom widget for icon (overridesicon)showCloseButton- Option to show/hide close buttononClose- Callback when close button is pressedcloseButtonColor- Custom close button color
-
SmartLoadingCard Customization:
titleWidget- Custom title widgetbodyWidget- Custom body widgetindicatorWidget- Custom loading indicator widgetshowCloseButton- Close button support
Changed #
- Enhanced example app with custom widget demonstrations
- Status cards now support both text-based and widget-based content
1.2.0 - 2024-01-01 #
Added #
-
Status Cards: Ready-to-use cards for displaying different states in the UI
SmartErrorCard- Error state card withfromException()factorySmartSuccessCard- Success state cardSmartWarningCard- Warning state cardSmartInfoCard- Information state cardSmartEmptyCard- Empty/no data state cardSmartLoadingCard- Loading state card with progress indicator
-
Pre-configured Status Cards:
SmartOfflineCard- No internet connection cardSmartSessionExpiredCard- Session expired cardSmartTimeoutCard- Request timeout cardSmartServerErrorCard- Server error with contact support optionSmartMaintenanceCard- Under maintenance cardSmartPermissionDeniedCard- Permission required cardSmartNotFoundCard- Resource not found (404) card
-
Enhanced Example App:
- Bottom navigation with 4 screens
- Basic Usage page with all core features
- Status Cards page showcasing all card types
- Loading Dialogs page with interactive demos
- Exception Handling page with error simulation
Changed #
- Improved example app structure with multiple screens
- Added metadata demonstration in example
1.1.0 - 2024-01-01 #
Added #
-
Exception Metadata Support: Attach debugging information to exceptions
- New
ExceptionMetadataclass with fields:operationName- Name of the failed operationendpoint- API endpoint (auto-extracted from Dio)requestMethod- HTTP method (auto-extracted from Dio)userId- User identifier for trackingsessionId- Session identifiertimestamp- When the error occurredextra- Custom key-value data
- All
SmartExceptionsubclasses now includemetadatafield withMetadata()method to attach metadata to existing exceptionstoMap()method for easy serialization/logging
- New
-
ExecuterOptions Metadata Fields:
operationName- Name the operation for debuggingmetadata- Attach custom data to exceptions
-
Auto-extraction from Dio: Endpoint and HTTP method are automatically extracted from
DioException
Changed #
ExceptionMapper.fromDioException()now accepts optional metadataExceptionMapper.fromException()now accepts optional metadata- Logging now includes metadata when
enableLoggingis true
1.0.0 - 2024-01-01 #
Added #
-
Result Pattern: Type-safe
Result<T>withSuccessandFailuresealed classesmap(),flatMap(),fold()for functional programming stylegetOrElse(),getOrCompute()for default valuesonSuccess(),onFailure()for side effects
-
SmartExecuter Core Methods:
execute<T>()- ReturnsResult<T>without UIrun<T>()- Executes with loading dialoginBackground<T>()- Executes without UI feedbackrunStream<T>()- Stream execution with progress dialoginBackgroundStream<T>()- Silent stream execution
-
Global Configuration (
SmartExecuterConfig):- Custom loading dialog builder
- Custom error snack bar builder
- Global error handler
- Session expiration handler
- Customizable messages (error, no connection, session expired)
- Retry configuration (max retries, delay)
- Connection checking by default option
- Logging toggle
-
Per-Operation Options (
ExecuterOptions):- Show/hide loading dialog
- Check connection before request
- Override retry settings
- Custom timeout
- Custom loading widget
- Barrier dismissible option
- Custom barrier color
-
Exception Hierarchy (sealed classes):
SmartException- Base exceptionConnectionException- No internet connectionConnectionTimeoutException- Connection timeoutSendTimeoutException- Request send timeoutReceiveTimeoutException- Response receive timeoutCancelledException- Request cancelledResponseException- Server error (with status code)SessionExpiredException- 401 UnauthorizedUnknownException- Unknown errorsExceptionMapper- Converts Dio exceptions to SmartExceptions
-
Loading Dialogs:
SmartLoadingDialog- Customizable circular progress dialogSmartProgressDialog- Linear progress with percentageSmartLoadingOverlay- Minimal fullscreen overlay
-
Snack Bars:
SmartErrorSnackBar- Error display with auto-coloringSmartSuccessSnackBar- Success message displaySmartSnackBars- Helper class for showing snack bars
-
Connectivity Utilities (
ConnectivityChecker):hasConnection()- Check if connectedgetStatus()- Get connection typesisConnectedViaWifi()- WiFi checkisConnectedViaMobile()- Mobile data checkisConnectedViaEthernet()- Ethernet checkonConnectivityChanged- Stream of connectivity changes
-
Retry Mechanism:
- Automatic retry with exponential backoff
- Configurable max attempts and delay
- Smart retry (skips non-retryable errors)
-
CancelToken Support:
- Pass Dio
CancelTokento cancel requests - Proper handling of cancelled requests
- Pass Dio
Changed #
- Complete rewrite of the library architecture
- Modular file structure under
lib/src/ - Improved error handling with sealed classes
- Removed dependency on external
ErrorInfoBarandAppWaitingDialog - All widgets now included in the package
Removed #
- Deprecated
while(true)busy-wait loops - Hard-coded Arabic strings (now configurable)
- External widget dependencies