Value<T extends Object> class
sealed
A nullable value that may or may not be present. This is used to represent three possible states:
- The value is absent. It will not be serialized.
- The value is present and null. It will be serialized as null.
- The value is present and non-null. It will be serialized as the value.
- Implementers
Constructors
- Value.absent()
-
The value is absent. It will not be serialized.
constfactory
- Value.present(T? value)
-
The value is present. It may still be be null.
If the value is null, it will be serialized as null.
If the value is non-null, it will be serialized as the value.
constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isPresent → bool
-
no setter
- requireValue → T?
-
Returns the value if present (no matter if null or non-null), otherwise throws a StateError.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- valueOrNull → T?
-
return the value if present and non-null, otherwise null.
this is useful for cases where you don't care between the value being absent or null.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited