FuturePredicate<T> typedef
A function type that evaluates a condition on a value and returns a boolean result.
This type alias represents a predicate function that can be either synchronous
or asynchronous, accepting a nullable value of type T
and returning either
a boolean or a Future<bool>. Used primarily for conditional validation logic.
The generic type T
represents the type of value being evaluated.
Example:
FuturePredicate<String> isValidEmail = (value) async {
if (value == null) return false;
return await validateEmailOnServer(value);
};
Implementation
typedef FuturePredicate<T> = FutureOr<bool> Function(T? value);