https://pub.dev/packages/dart_either/versions/2.0.0
-
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)
What's Changed
- chore(deps): update codecov/codecov-action action to v3.1.1 by @renovate in #11
- chore(deps): update dart-lang/setup-dart action to v1.4 by @renovate in #12
- chore(deps): update codecov/codecov-action action to v3.1.2 by @renovate in #13
- chore(deps): update codecov/codecov-action action to v3.1.6 by @renovate in #14
- fix(deps): update dependency http to v1 - autoclosed by @renovate in #15
- chore(deps): update actions/checkout action to v4 by @renovate in #17
- chore(deps): update codecov/codecov-action action to v4 by @renovate in #19
- dart 3.0.0, switch expression, sealed class by @hoc081098 in #23
Full Changelog: 1.0.0...2.0.0