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

An easy approach of two types returning for Dart.

Ez_Either #

Most times I add packages such as fpdart to my projects and I notice that the only thing I am really using in my code is Either. To solve this, I'm creating this package that is nothing but a simpler version of Either.

Installing #

# pubspec.yaml
dependencies:
  ez_either: ^1.0.0 # Check out the latest version

Usage #

You should use Either when your code can return two different types, a Right (That should be the type you need to keep your business flow going on) and a Left (A exception, error or something that will need to be handled)

import "package:ez_either:ez_either.dart";

// It is recommended to extract value using fold
final Either<Failure, UserDto> userOrFailure = Right(UserDto());

print(either.isRight()); // true
print(either.isLeft()); // false

final result = usersOrFailure.fold(
  (left) => left,
  (right) => right,
);
0
likes
130
pub points
2%
popularity

Publisher

unverified uploader

An easy approach of two types returning for Dart.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on ez_either