-
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)
- This is our first stable release.
- Initial version, created by Stagehand