- Adds [getOrThrow] method
- Supports new dart 3 features
- Major release. [BREAKING]
- Drop the support for every parse/helper method and keep the [Result] simple as it was its initial purpose.
- Rename
onSuccess
andonError
towhenSuccess
andwhenError
to match thewhen
method.
-
Change to
flatMap
inAsyncResult
allowing synchronousResult
chaining:
We noticed that we can receive aFutureOr
instead of aFuture
in theflatMap
anonymous function, more specifically in theAsyncResult
. Now we hope to be able to chain asynchronous and synchronous functions inAsyncResult
.
Note that this update only reflects on theAsyncResult
, this means that theResult.flatMap
will not change and will still only accept synchronous results(No-Future here). -
New operators for
Error
result:
We have always been supportingSuccess
value transformation and now we want to show that we care about the flow of errors.
That's why we added 2 specific operators forResult
ofError
:flatMapError
.pureError
-
Welcome
fold
:
multiple_result
is a proposal based onEither
fromdartz
,sealed class
fromKoltin
, in addition to theResult
objects seen inSwift
andKotlin
. Some developers might be uncomfortable withoutfold
. That's why we are bringingfold
as an alias ofwhen
, that is, bothwhen
andfold
do exactly the same thing!
Help us figure out which one to remove in the near future. -
SWAP:
This new operand will be useful when you need to swapSuccess
andError
.
Result<String, int> result = getResult();
Result<int, String> newResult = result.swap();
- fix doc
- 100% Test Coverage!!.
- Refactor
AsyncResult
. - Remove deprecated operator
get()
.
Thanks to Jacob
- Add new operators in Result:
New operators will allow transforming success and error values before the values are extracted.
- map
- mapError
- flatMap
- pure
- Create Unit type (and deprecate
SuccessResult
) - Add
AsyncResult
to perform asynchronous computation.
- BREAKING: Rename
getSuccess
totryGetSuccess
andgetError
totryGetError
methods. - BREAKING: Flip the order of the Success and Error types. Thanks to JoDeveloper for executing and RalphBergmannKMB for proposing.
- If you
Result<Exception, String>
now you must useResult<String, Exception>
to improve readability.
- If you
- Add
onSuccess
andonError
methods to handle the result only in these cases.
- Adds getSuccess and getError methods
- Adds SuccessResult and success const
- Adds @immutable annotation to Success and Error classes to help in the tests | Thanks to Eronildo!
- Adds @sealed annotation to Result class | Thanks to Jacob!
- Adds documentation
- Changes library to multiple_result
- Initial release