resilify 1.0.0
resilify: ^1.0.0 copied to clipboard
Unified Result-based API handling for Dart & Flutter — works with http, Dio, Retrofit, Chopper, and WebSocket. No exceptions. Just results.
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.
1.0.0 — Initial release #
Added #
-
Core
- Sealed
Result<T>withSuccess<T>andError<T>variants (Dart 3). - Structured
Failurevalue type with named constructors:network,timeout,badResponse,parsing,unauthorized,notFound,serverError,cancelled,unknown. - Synchronous extensions:
isSuccess,isError,dataOrNull,errorOrNull,getOrElse,getOrThrow,onSuccess,onError. when,fold,map,flatMaponResult<T>.- Async helpers on
Future<Result<T>>:mapAsync,flatMapAsync,recover. - Stream helpers on
Stream<Result<T>>:mapStream,whereSuccess,whereError,dataStream,listenResult. - List helpers on
Result<List<T>>:mapList,filter,whereResult,firstOrError. RetryHelper.retrywith exponential backoff, predicate-based retry, and per-attempt observer.
- Sealed
-
Integrations (each opt-in via its own barrel file)
resilify_http.dart—HttpResultHandlerforpackage:http.resilify_dio.dart—DioResultHandler(incl.upload/downloadwith progress) andResultLoggerInterceptor.resilify_retrofit.dart—.toResult()on Retrofit-generated futures.resilify_chopper.dart—.toResult()on ChopperResponse<T>futures with pluggable failure mappers.resilify_websocket.dart—WebSocketResultHandler<T>with auto-reconnect and exponential backoff.