AwaiterData<T> class
Holds and validate the data loaded by a FutureAwaiter. Optionally expires after expireDataAfter
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
T?> - AwaiterData
- Implemented types
- Available extensions
Constructors
-
AwaiterData({bool validateData = true, T? value, Duration? expireDataAfter, List<
string? Function(T?)> validations = const []})
Properties
- data → T?
-
no setter
- error ↔ Object?
-
getter/setter pair
- expireAt → date?
-
no setter
- expired ↔ bool
-
return true if last expireAt is less than now
getter/setter pair
- expireDataAfter ↔ Duration?
-
getter/setter pair
- hasData → bool
-
Return true if data contains a non-null value. If validateData is true, also validate the data against
Object.IsValid
function.no setter - hasError → bool
-
Return true if error is not null
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- loadedAt ↔ date?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- validateData → bool
-
When true, validate the snapshot data against the
Object.IsValid
function. Empty List or Map, Map with all values empty, num = 0, empty or blank String will be considered empty data if this is true.final -
validations
↔ List<
string? Function(T?)> -
getter/setter pair
- value ↔ T?
-
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clear(
) → void -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
) → Iterable< String> -
Validates the current instance and returns a list of error messages if the instance is invalid.
override
-
validateOrThrow<
T extends Exception> ([T exception(Iterable< String> errors)?]) → void -
Available on Validator, provided by the ValidatorClassExtensions extension
Validates the object and throws an exception if there are any errors.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited