CustomFormController<T> class abstract

A generic form controller for validating any type of form field.

This controller is designed for use with dropdowns, date pickers, and other non-text form fields. It provides validation without text-specific features like formatters, regex filters, or text input types.

Example usage for dropdowns:

enum MyEnum { option1, option2, option3 }

class MyDropdownController extends CustomFormController<MyEnum?> {
  @override
  String? Function(MyEnum? value)? get validator => (value) {
    if (value == null) {
      return 'Please select an option';
    }
    return null;
  };
}

Example usage for date pickers:

class DateController extends CustomFormController<DateTime?> {
  @override
  String? Function(DateTime? value)? get validator => (value) {
    if (value == null) {
      return 'Please select a date';
    }
    if (value.isBefore(DateTime.now())) {
      return 'Date must be in the future';
    }
    return null;
  };
}
Available extensions

Constructors

CustomFormController()

Properties

hashCode int
The hash code for this object.
no setterinherited
helper CustomFormControllerHelper<T>
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validator String? Function(T? value)?
validator A function that validates the input value.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetErrorTracking() → void

Available on CustomFormController<T>, provided by the CustomFormControllerExtension extension

toString() String
A string representation of this object.
inherited

Operators

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