isType<T> function

IValidator isType<T>()

Returns a Validator that checks if the given value is the correct type

Implementation

IValidator isType<T>() => validator(
      (value) => value is T,
      (value) => Expectation(message: T.toString(), value: value, code: 'type.mismatch', data: {
        'expected': T.toString(),
        'found': value.runtimeType.toString(),
      }),
    );