multiple_result 5.1.0 copy "multiple_result: ^5.1.0" to clipboard
multiple_result: ^5.1.0 copied to clipboard

Multiple results for dart. Inspired by dartz's Either and Kotlin's sealed classes

5.1.0 07/17/2023 #

  • Adds [getOrThrow] method

5.0.0 05/10/2023 #

  • Supports new dart 3 features

4.0.0 - 12/21/2022 #

  • Major release. [BREAKING]
    • Drop the support for every parse/helper method and keep the [Result] simple as it was its initial purpose.
    • Rename onSuccess and onError to whenSuccess and whenError to match the when method.

[3.2.0] - 12/08/2022 #

  • Change to flatMap in AsyncResult allowing synchronous Result chaining:
    We noticed that we can receive a FutureOr instead of a Future in the flatMap anonymous function, more specifically in the AsyncResult. Now we hope to be able to chain asynchronous and synchronous functions in AsyncResult.
    Note that this update only reflects on the AsyncResult, this means that the Result.flatMap will not change and will still only accept synchronous results(No-Future here).

  • New operators for Error result:
    We have always been supporting Success value transformation and now we want to show that we care about the flow of errors.
    That's why we added 2 specific operators for Result of Error:

    1. flatMapError.
    2. pureError
  • Welcome fold:
    multiple_result is a proposal based on Either from dartz, sealed class from Koltin, in addition to the Result objects seen in Swift and Kotlin. Some developers might be uncomfortable without fold. That's why we are bringing fold as an alias of when, that is, both when and fold 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 swap Success and Error.

Result<String, int> result = getResult();
Result<int, String> newResult = result.swap();
  • fix doc

[3.1.0] - 12/05/2022 #

  • 100% Test Coverage!!.
  • Refactor AsyncResult.
  • Remove deprecated operator get().

[3.0.0] - 12/05/2022 #

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.

[2.0.0] - 12/03/2022 #

  • BREAKING: Rename getSuccess to tryGetSuccess and getError to tryGetError 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 use Result<String, Exception> to improve readability.
  • Add onSuccess and onError methods to handle the result only in these cases.

[1.0.4] - 07/19/2021 #

  • Adds getSuccess and getError methods
  • Adds SuccessResult and success const

[1.0.3] - 05/02/2021 #

  • Adds @immutable annotation to Success and Error classes to help in the tests | Thanks to Eronildo!

[1.0.2] - 03/28/2021 #

  • Adds @sealed annotation to Result class | Thanks to Jacob!

[1.0.1] - 03/26/2021 #

  • Adds documentation
  • Changes library to multiple_result

[1.0.0] - 03/23/2021 #

  • Initial release
145
likes
160
pub points
95%
popularity

Publisher

unverified uploader

Multiple results for dart. Inspired by dartz's Either and Kotlin's sealed classes

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on multiple_result