eitherx
library
Either
is a generic class in Dart that represents a value of
one of two possible types: L
or R
. The class is useful when
you want to return a value that can either be of type L
or of
type R
, but not both.
This class is inspired by the Either data type in functional
programming and provides a way to handle errors and exceptions
in a more expressive and concise way.
Classes
-
Either<L, R>
-
-
Left<L, R>
-
A class that represents the left value in an
Either instance.
-
Right<L, R>
-
A class that represents the right value in
an Either instance.
-
Unit
-
The Unit class represents the
void
type in Dart.
Constants
-
unit
→ const Unit
-
A single value of type Unit that represents
void
.
Functions
-
left<L, R>(L left)
→ Either<L, R>
-
Creates a new instance of Left with a value
of type
L
.
-
right<L, R>(R right)
→ Either<L, R>
-
Creates a new instance of Right with a value
of type
R
.