Skip to content

Commit

Permalink
fix: AsyncResult recover
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobaraujo7 committed Dec 22, 2022
1 parent 21334a0 commit 9a1e793
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.0.3] - 2021-12-22

* fix: AsyncResult recover

## [1.0.2] - 2021-12-18

* fix: separed functions.dart import
Expand Down
6 changes: 4 additions & 2 deletions lib/src/async_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ extension AsyncResultExtension<S extends Object, F extends Object> //
/// Returns the encapsulated `Result` of the given transform function
/// applied to the encapsulated a `Failure` or the original
/// encapsulated value if it is success.
AsyncResult<S, F> recover(Result<S, F> Function(F failure) onFailure) {
return then((result) => result.recover(onFailure));
AsyncResult<S, F> recover(
FutureOr<Result<S, F>> Function(F failure) onFailure,
) {
return then((result) => result.fold(Success.new, onFailure));
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: result_dart
description: Result for dart. It is an implementation based on Kotlin Result and Swift Result.
version: 1.0.2
version: 1.0.3
repository: https://github.com/Flutterando/result_dart

environment:
Expand Down

0 comments on commit 9a1e793

Please sign in to comment.