isYoutubeVideoUrl method

FieldValidator<String?, String> isYoutubeVideoUrl({
  1. MessageCallBack<String>? message,
  2. String? id,
})

Check string is youtube video url

Implementation

FieldValidator<String?, String> isYoutubeVideoUrl({
  MessageCallBack<String>? message,
  String? id,
}) {
  return next((messages, value) {
    if (!value.isYoutubeVideoUrl(id: id)) {
      return message?.call(messages, value) ??
          messages.invalidYoutubeVideoUrl(id ?? 'empty');
    }
    return null;
  });
}