flattenedErrors property

Map<String, String> get flattenedErrors

Flattened map containing only the first error string per field.

Ideal for direct mapping to form input validation UI states.

final formErrors = validationErrors.flattenedErrors;
// e.g. {'email': 'Email is required', 'password': 'Too short'}

Implementation

Map<String, String> get flattenedErrors {
  final result = <String, String>{};
  for (final entry in _fieldErrors.entries) {
    if (entry.value.isNotEmpty) {
      result[entry.key] = entry.value.first;
    }
  }
  return result;
}