withMessageFormatter method

Formix<T, String> withMessageFormatter(
  1. ErrorMessageFormatter<E> formatter
)

Maps errors to user-facing messages using formatter.

This is a convenience wrapper around mapError for structured formatter classes.

final validator = authRule.withMessageFormatter(const AuthErrorFormatter());
final result = validator.validate('');
// result.errorOrNull == 'Email is required'

Implementation

Formix<T, String> withMessageFormatter(ErrorMessageFormatter<E> formatter) =>
    mapError(formatter.format);