call method

String? call(
  1. String? text
)

Implementation

String? call(String? text) {
  if (text == null || text.isEmpty) return allowEmpty ? null : message;
  String s = trim ? text.trim() : text;
  if (s.isEmpty) return allowEmpty ? null : message;
  RegExpMatch? m = regex.firstMatch(s);
  switch (matchType) {
    case MatchType.None:
      return m == null ? null : message;
    case MatchType.Start:
      return m?.start == 0 ? null : message;
    case MatchType.End:
      return m?.end == s.length ? null : message;
    case MatchType.Contains:
      return m != null ? null : message;
    case MatchType.Entire:
      return m?.start == 0 && m?.end == s.length ? null : message;
  }
}