startsWith<E> static method

Rule<String, E> startsWith<E>(
  1. String prefix, {
  2. required E error,
})

Validates that the string starts with prefix.

StringRules.startsWith('+', error: 'Must start with +')

Implementation

static Rule<String, E> startsWith<E>(String prefix, {required E error}) =>
    PredicateRule(
      predicate: (value) => value.startsWith(prefix),
      error: error,
    );