isValid method
Returns true if the state is valid according to this validator's rules.
Implementation
@override
bool isValid(S state) {
return switch (state) {
String() => state.isNotEmpty,
Iterable() => state.isNotEmpty,
bool() => null is S || state,
_ => state != null,
};
}