hasSpecialChar<E> static method

Rule<String, E> hasSpecialChar<E>({
  1. required E error,
})

Validates that the string contains at least one special character.

StringRules.hasSpecialChar(error: 'Must contain special character')

Implementation

static Rule<String, E> hasSpecialChar<E>({required E error}) => PredicateRule(
      predicate: (value) => value.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]')),
      error: error,
    );