when method

Formix<T, E> when(
  1. bool condition(
    1. T value
    )
)

Conditionally applies this validator based on condition.

If condition returns true, runs this validator. Otherwise, returns valid without running validation.

final validator = emailRule.when((value) => value.isNotEmpty);

Implementation

Formix<T, E> when(bool Function(T value) condition) =>
    When(condition: condition, validator: this);