app_smart_network 1.0.0
app_smart_network: ^1.0.0 copied to clipboard
A smart Flutter network package with built-in error handling, retry logic, and multilingual error messages (en/ar).
1.0.0 #
Initial stable release.
Features #
ApiServicesingleton withinitialize(NetworkConfig)entry pointNetworkConfig— configure base URL, timeouts, default headers, SSL, and unauthorized callbackHttpMethodenum —get,post,put,patch,deleteRequestService— unified HTTP request execution with connectivity guard and mobile timeout extensionDownloadRequestService— file download with progress callbackUploadRequestService— multipart file upload with extra fields and progress callbackNetworkLocale— locale-aware error messages; built-in English and Arabic translations covering all standard HTTP status codes and network error types; extensible viaaddTranslations()setAppLocale(locale)— setsAccept-Languageheader and switches error-message locale in one callErrorHandler— convertsDioExceptiontoApiExceptionwith translated messagesApiException— rich exception withstatusCode,apiErrorCode,errorCategory,hasApiErrorCode(), andgetResponseField()ServerFailure/CacheFailure— domain-layerFailurewrappers (Equatable)- Automatic retry on idempotent methods (GET, PUT, DELETE) with exponential back-off (3 retries: 1 s, 2 s, 3 s)
- Connectivity check before every request with a single 600 ms retry for transient states
- Background JSON decoding via
computeisolate - Debug request/response logging via
PrettyDioLogger(debug builds only) - Per-request
baseUrloverride, cancel token, query parameters, and send/receive progress callbacks example/app demonstrating all features against JSONPlaceholder API