either_dart 1.0.0 copy "either_dart: ^1.0.0" to clipboard
either_dart: ^1.0.0 copied to clipboard

Error handler library for type-safe and easy work with errors on Dart and Flutter. Either is an alternative to Nullable value and Exceptions.

[1.0.0] - Dart 3 support #

remove deprecated methods from Future[Either]

Either is now sealed - this gives you support pattern matching.

You now have an alternative for the fold and either

before:


final either = ...;

final result = either.fold(
  (left) => do something with left
  (right) => do something with right
);

after:


final either = ...;

switch (either) {
  case Left(value: final left):
    do something with left
  case Right(value: final right):
    do something with right
}

Thanks to @dballance for creating the issue

Also, you can still use:
either.isLeft - check either is left
either.isRight- check either is right

[0.4.0] - Update Future[Either].fold and Add Either.tryExcept #

Provide more async flexible type support for FutureEither's fold operation.

Thanks to @lukasbalaz for creating the issue

add:

  • tryExcept - A simple but powerful constructor for exception handling. Just specify the type of error you expect from the function and you will get Either<ExpectedError, RightType>

[0.3.0] - Add equality and hash override #

Either now overrides equality and hash.

Thanks to @memishood for creating the issue

[0.2.0] - Update Future[Either] #

Updated to support FutureOr<T> instead of Future<T>:

  • Either:
    • thenAsync
    • thenLeftAsync
    • mapAsync
    • mapLeftAsync
  • Future[Either]:
    • thenRight
    • thenLeft

Updated to support FutureOr<T> instead of T:

  • Future[Either]:
    • mapRight
    • mapLeft

Mark deprecated (not delete):

  • Future[Either].thenRightSync
  • Future[Either].thenLeftSync
  • Future[Either].mapRightAsync
  • Future[Either].mapLeftAsync

The following methods were not needed after FutureOr support, so they are marked Deprecated.

[0.1.4] - Update docs #

Update:

  • Readme

(just this)

[0.1.3] - Additional functionality #

Added:

  • thenLeft
  • thenLeftAsync
  • similiar methods for FutureEither<L, R> extension

[0.1.2] - Fixs #

Fixed:

  • remove the lint warning from Either.tryCatch

[0.1.0-nullsafety.2] - Additional functionality and fixes #

Added:

  • mapLeftAsync
  • FutureEither<L, R> extension

Fixed:

  • change the naming of the async methods of Either class

Changes Either:

  • asyncThen -> thenAsync
  • asyncMap -> mapAsync

[0.1.0-nullsafety.1] - Additional functionality #

Added:

  • mapLeft

Fixed:

  • documentation

[0.1.0-nullsafety.0] - Additional functionality #

Added:

  • null-safety
  • swap method
  • const constructor for Left and Right

Changed:

  • rename unite to fold

[0.0.5] - Additional functionality #

Added:

  • asyncMap
  • asyncThen

[0.0.4] - Bug fixs #

Fixed:

  • Not convenient use with autocomplete

[0.0.3] - Additional functionality and testing #

Added:

  • Unit test
  • Lazy condition
  • Flutter example

[0.0.2] - Additional functionality and testing #

Added:

  • Unit test
  • creators by:
    • condition
    • exception

Fixed:

  • pubspec
  • Readme

[0.0.1] - The base implementation either. #

Added:

  • Base implementation
  • Unit test
  • Example with flutter
130
likes
130
pub points
97%
popularity

Publisher

unverified uploader

Error handler library for type-safe and easy work with errors on Dart and Flutter. Either is an alternative to Nullable value and Exceptions.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on either_dart