VeryGoodOpenSource / formz

A unified form representation in Dart used at Very Good Ventures 🦄

Home Page:https://pub.dev/packages/formz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Determining when to show meaningful errors

jolexxa opened this issue · comments

Currently, the error property on pure, invalid instances of FormzInput is non-null, indicating what the validation error was. Perhaps Formz could expose an additional getter for UI purposes to indicate that the validation error, while correct, is typically ignored for pure forms from a UI perspective. Ignoring validation errors on unmodified (pure) fields typically creates a more pleasant UI experience, and a mechanism like this might better facilitate that.

abstract class FormzInput<T, E> {
  E? get displayError = pure ? null : error;
  E? get error => validator(value);
  ...

Other approaches could also solve the same problem, I'm sure.