validateAsync method

Future<Result> validateAsync(
  1. dynamic value, {
  2. bool exists = true,
})

Always returns a Future, allowing async + sync validators to compose.

Implementation

Future<Result> validateAsync(dynamic value, {bool exists = true}) async {
  if ((value == null && isNullable && exists) || (!exists && isOptional)) {
    return Result.valid(value);
  }
  return await validator(value);
}