Just<T> class
Represents an existing value of type T.
- Implemented types
-
- Maybe<
T>
- Maybe<
Constructors
- Just(T value)
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
The wrapped value.
final
Methods
-
as<
R> () → Maybe< R> -
WARNING! This method is experimental and may be removed in the future versions.
Forceful typecast to
R
.override -
chain(
Maybe< T> next) → Maybe<T> -
If this is Nothing, returns
next
. Otherwise return this..override -
fallback(
Maybe< T> next()) → Maybe<T> -
If this is Nothing, returns the result of
next
. Otherwise return this..override -
flatMap<
P> (Maybe< P> mapper(T value)) → Maybe<P> -
Maps the value to P.
override
-
ifNothing(
void callback()) → Maybe< T> -
Calls the
callback
function if the wrapped value is not present.override -
ifPresent(
void consumer(T value)) → Maybe< T> -
Calls the
consumer
if the wrapped value is present.override -
map<
P> (P mapper(T value)) → Maybe< P> -
Maps the value to P.
override
-
merge<
R, V> (Maybe< V> other, Merger<R, T, V> merger) → Maybe<R> -
If this and the
other
are both Just values, merges them using themerger
function and returns Justoverride -
merge2<
R, V1, V2> (Maybe< V1> v1, Maybe<V2> v2, Merger2<R, T, V1, V2> merger) → Maybe<R> -
Same as merge, but with 2 arguments.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
or(
T defaultValue) → T -
Returns the wrapped value (if present), or the
defaultValue
.override -
orAsync(
Future< T> defaultValue) → Future<T> -
Returns a Future of the wrapped value (if present), or the
defaultValue
.override -
orGet(
T producer()) → T -
Returns the wrapped value (if present), or the result of the
producer
.override -
orGetAsync(
Future< T> producer()) → Future<T> -
Returns a Future of the wrapped value (if present), or the result of the
producer
.override -
orThrow(
Object producer()) → T -
Returns the wrapped value (if present), or throws the result of the
producer
.override -
toString(
) → String -
A string representation of this object.
inherited
-
tryMap<
P> (P mapper(T value)) → Maybe< P> -
Tries to map value to P. If the
mapper
throws anything (not just an Exception), returnsNothing<P>
.override -
type<
P> () → Maybe< P> -
Narrows the type to P if the value is present and has actually the type of P.
override
-
where(
bool predicate(T value)) → Maybe< T> -
Filter the value using the
predicate
.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override