PackageTrack
Sign in Get early access

result_monad

A Dart implementation of the Result Monad which allows for more expressive result generation and processing without using exceptions.

4.0.0 3.1K downloads/mo #4612 most downloaded on pub.dev source

What this package is like to depend on

Last release 5 months ago

23 Mar 2026

Ships fairly regularly

a new release about every 10 months

Nearly every release is documented

notes for 14 of 15 stable releases

Nothing withdrawn

no release was ever pulled

5 years old

15 releases · first in 2021

4 releases in the last 12 months

see the full history below

Release timeline

15 releases · Nov 2021 to Mar 2026
2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 15
  1. 4.0.0 23 Mar 2026
    Release notes
    • Change Ok class's field to be "value" which overrides base-class value property. Since the 3.x version has been pulled and this technically changes the field of Ok, even though it wouldn't normally be used. This technically bumps the version number to 4.0.0
    Open source →
  2. 3.0.2 21 Mar 2026
    Release notes
    • Fix having version in CHANGELOG align with pub.dev version to get perfect score.
    Open source →
  3. 3.0.1 21 Mar 2026
    Release notes
    • Update README to new syntax
    Open source →
  4. 3.0.0 21 Mar 2026
    Release notes

    NOTE 1: This release has some breaking changes and an increased minimum SDK version bump from the 2.3.2 release.

    NOTE 2: Many thanks to the contributions to the ADT-related updates and StackTrace functionality updates contributed by Daniel Gomez Rico ([email protected]). Some of the changes were taken through Pull Request acceptance while others were back-ported with some changes from his fork of this project

    • Underlying architecture now uses Algebraic Data Type (ADT) functionality introduced with class modifiers and patterns in Dart 3.0.0 in May 2023.
      • This made the syntax for creating Results more compact (and preferred way to create Results now):
        • Result.ok('Good') => Ok('Good)
        • Result.error('Bad') => Error('Bad')
      • This also makes it so you can use switch statements, if statements, et cetera on return values directly, although somewhat redudant with the various aggregation operations in the library.
      • Example:
    // The below fold function...
    final value = invert(2).fold(
      onSuccess: (v) => v,
      onError: (e, trace) => e,
    );
    
    // Can be expressed:
    final value = switch (invert(2)) {
      Ok o => o.value,
      Error e => e.cause,
      Result _ => throw UnimplementedError(), // there since Result isn't sealed
    };
    
    • Breaking change: Minimum Dart version bumped up from 2.14.4 to 3.0.0
    • Breaking change: Added Stack Trace following functionality so can get insight into where the error occurred in a chain of calls. This changed the function signatures on the following method to add access to stack traces when processing errors
      • On Result: fold, match, withError, withErrorAsync
      • On FutureResult: fold, match, withError, withErrorAsync
    • Add optional StackTrace parameter on Error result creation Error('Bad', StackTrace.current)
    • Result has a stackTrace property that can be called if and only if the type is an Error. Result can be null.
    • Result has asOk and asError properties for casting to specific type. This will throw an Exception if is against the underlying type for that instance.
    • Thanks to GitLab User DoodleSchrank for adding additional pass-through methods on FutureResult to their corresponding Result methods: getErrorOrElse, getValueOrElse, getErrorOrElseAsync, getValueOrElseAsync
    • Updated examples and documentation to reflect the syntax updates.
    Open source →
  5. 2.3.2 05 Jan 2024
    Release notes
    • Tweak to documentation headers to avoid lint error
    Open source →
  6. 2.3.1 05 Jan 2024
    Release notes
    • Tweak to README to include withError and withErrorAsync
    Open source →
  7. 2.3.0 05 Jan 2024
    Release notes
    • Examples and documentation updates for the new syntax.
    • Add to FutureResult: andThen, errorCast, mapError, mapValue, withResult, withError, match, fold
    • Add withError to Result and withError and withErrorAsync to FutureResult
    Open source →
  8. 2.2.0 19 Apr 2023

    Nothing published for this version

  9. 2.1.0 18 Apr 2023
    Release notes
    • Add pass through methods withResult and withResultAsync on Result and Future extension method
    Open source →
  10. 2.0.2 09 Oct 2022
    Release notes
    • Add exception catching on addThen and addThenSuccess and FutureResult extension methods.
    Open source →
  11. 2.0.1 09 Oct 2022
    Release notes
    • Tweaks to the README only.
    Open source →
  12. 2.0.0 09 Oct 2022
    Release notes
    • Allow nullable types for success and failure types
    • Add andThenSuccess and andThenSuccessAsync methods for allowing returning results without explicit Result.ok wrapping to allow more concise syntax
    • Add extension methods on FutureResult to make async chaining syntax much more concise
    • Add errorCast method for when need to pass up an error Result with the same error type with different success type.
    Open source →
  13. 1.0.2 28 Nov 2021
    Release notes
    • Tweaks to API documentation
    • Added temp file "intermediate" level example and added it to example.md as well
    Open source →
  14. 1.0.1 27 Nov 2021
    Release notes
    • Added an example.md file for pub.dev.
    Open source →
  15. 1.0.0 27 Nov 2021
    Release notes
    • Initial version.
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive