isValid method

  1. @override
bool isValid(
  1. S state
)
override

Returns true if the state is valid according to this validator's rules.

Implementation

@override
bool isValid(S state) {
  return switch (state) {
    String() => state.length <= value,
    Iterable() => state.length <= value,
    _ => false,
  };
}