resolve method
Resolves this instance.
validate
if returnsfalse
will resolve todefaultValue
.- If resolved value is null will return
defaultValue
.
Implementation
FutureOr<T> resolve(
{FutureOr<bool> Function(T val)? validate, T? defaultValue}) {
if (validate == null && defaultValue == null) {
return this;
}
var self = this;
if (self is Future<T>) {
return self.then((value) =>
_validate(value, validate: validate, defaultValue: defaultValue)
as FutureOr<T>);
} else {
return _validate<T>(this as T,
validate: validate, defaultValue: defaultValue) as FutureOr<T>;
}
}