result_dart 2.0.0 result_dart: ^2.0.0 copied to clipboard
Result for dart. It is an implementation based on Kotlin Result and Swift Result.
[2.0.0] - 2024-12-11 #
- This version aims to reduce the
Result
boilerplate by making theFailure
type Exception by default. This will free the Result from having to typeFailure
, making the declaration smaller.
If there is a need to type Failure
, use ResultDart
.
Added #
- Introduced
typedef
forResult<S>
andAsyncResult<S>
to simplify usage:Result<S>
is a simplified alias forResultDart<S, Exception>
.AsyncResult<S>
is a simplified alias forAsyncResultDart<S, Exception>
.
Changed #
- Replaced
Result
class withResultDart
as the base class for all results.- Default failure type for
ResultDart
is nowException
. - This change reduces boilerplate and improves usability by eliminating the need to specify the failure type explicitly in most cases.
- Default failure type for
Removed #
- Remove factories
Result.success
andResult.failure
.
Migration Guide #
- In version >=2.0.0, the Failure typing is by default an
Exception
, but if there is a need to type it, useResultDart<Success, Failure>
.
only Success
type:
// Old
Result<int, Exception> myResult = Success(42);
// NEW
Result<int> myResult = Success(42);
with Success
and Failure
types:
// Old
Result<int, String> myResult = Success(42);
// NEW
ResultDart<int, String> myResult = Success(42);
[1.1.1] - 2023-07-05 #
- pump Dart version to 3.0.0
- fix: factory const
[1.1.0] - 2023-07-05 #
- feat: Added onSuccess and onFailure callbacks
[1.0.6] - 2023-05-11 #
- feat: Dart 3.0.0 support
[1.0.5] - 2023-01-26 #
- feat: Added FutureOr in AsyncResult.MapError
[1.0.4] - 2023-01-26 #
- feat: Added FutureOr in AsyncResult.Map
[1.0.3] - 2022-12-22 #
- fix: AsyncResult recover
[1.0.2] - 2022-12-18 #
- fix: separed functions.dart import
[1.0.1] - 2022-12-17 #
- fix: recover operator return a
Result
instead aFailure
.
[1.0.0+2] - 2022-12-16 #
- Initial release