isTimeOfDay method

FieldValidator<String?, TimeOfDay> isTimeOfDay([
  1. MessageCallBack<String>? message
])

check is the value is TimeOfDay

Implementation

FieldValidator<String?, TimeOfDay> isTimeOfDay(
    [MessageCallBack<String>? message]) {
  return next((messages, value) {
    if (!value.isTimeOfDay) {
      return message?.call(messages, value) ?? messages.isTimeOfDay;
    }
    return null;
  }).transform((value) => value.toTimeOfDay()!);
}