Skip to content

Commit

Permalink
fix: recover operator return a Result instead a Result
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobaraujo7 committed Dec 17, 2022
1 parent 2c23cb2 commit b7388c2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.0.0+2] - 2021-12-16

* Initial release
## [1.0.1] - 2021-12-17

* fix: recover operator return a `Result` instead a `Result`.
2 changes: 1 addition & 1 deletion lib/src/async_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ 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(Success<S, F> Function(F failure) onFailure) {
AsyncResult<S, F> recover(Result<S, F> Function(F failure) onFailure) {
return then((result) => result.recover(onFailure));
}
}
6 changes: 3 additions & 3 deletions lib/src/result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ abstract class Result<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.
Result<S, F> recover(Success<S, F> Function(F failure) onFailure);
Result<S, F> recover(Result<S, F> Function(F failure) onFailure);
}

/// Success Result.
Expand Down Expand Up @@ -186,7 +186,7 @@ class Success<S extends Object, F extends Object> implements Result<S, F> {
}

@override
Result<S, F> recover(Success<S, F> Function(F failure) onFailure) {
Result<S, F> recover(Result<S, F> Function(F failure) onFailure) {
return Success<S, F>(_success);
}

Expand Down Expand Up @@ -293,7 +293,7 @@ class Failure<S extends Object, F extends Object> implements Result<S, F> {
}

@override
Result<S, F> recover(Success<S, F> Function(F failure) onFailure) {
Result<S, F> recover(Result<S, F> Function(F failure) onFailure) {
return onFailure(_failure);
}

Expand Down
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.0+2
version: 1.0.1
repository: https://github.com/Flutterando/result_dart

environment:
Expand Down

0 comments on commit b7388c2

Please sign in to comment.