dart_either 2.0.0 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, andControlError
a final class. Now you can use exhaustive switch expressions onEither
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