FormSchema class abstract

A schema that defines the form fields and their validators.

class SignInFormSchema extends FormSchema {
  SignInFormSchema()
      : super(
          fields: {
            FormFieldScheme<String>(
              email,
              validators: (_, __) {}.email().required(),
            ),
            FormFieldScheme<String>(
              password,
              validators: (String ? value, __) {
                // You can specify custom validation function like that.
                if(value == 'password'){
                  return '"password" not allowed.'
                }
              }.required(),
            ),
          },
        );

  static const TypedId<String> email = TypedId('email');
  static const TypedId<String> password = TypedId('password');
}

Constructors

FormSchema.new({required Set<FormFieldScheme> fields})
Creates a FormSchema instance.
const

Properties

fields Set<FormFieldScheme>
The form fields.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

field<T>(TypedId<T> id) FormFieldScheme<T>?
Get a form field by its id.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited