dart_either 2.0.0 copy "dart_either: ^2.0.0" to clipboard
dart_either: ^2.0.0 copied to clipboard

Either monad for Dart language and Flutter framework. Type-safe error handling, railway oriented programming. Supports Monad comprehensions, async map, async flatMap.

2.0.0 - Sep 01, 2024 #

  • Require Dart 3.0.0 or higher >=3.0.0 <4.0.0.

  • Make Either a sealed class, EitherEffect a sealed class, and ControlError a final class. Now you can use exhaustive switch expressions on Either instances.

    final Either<String, int> either = Either.right(10);
      
    // Use the `when` method to handle
    either.when(
      ifLeft: (l) => print('Left: $l'),
      ifRight: (r) => print('Right: $r'),
    ); // Prints Right: Either.Right(10)
      
    // Or use Dart 3.0 switch expression syntax 🤘
    print(
      switch (either) {
        Left() => 'Left: $either',
        Right() => 'Right: $either',
      },
    ); // Prints Right: Either.Right(10)
    

1.0.0 - Aug 23, 2022 #

  • This is our first stable release.

0.0.1 - Apr 27, 2021 #

  • Initial version, created by Stagehand
12
likes
150
pub points
81%
popularity

Publisher

unverified uploader

Either monad for Dart language and Flutter framework. Type-safe error handling, railway oriented programming. Supports Monad comprehensions, async map, async flatMap.

Repository (GitHub)
View/report issues

Topics

#hoc081098 #functional-programming #fpdart #dartz #either

Documentation

API reference

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

built_collection, meta

More

Packages that depend on dart_either