FieldState class
Everything one form field widget needs to render itself, handed down by a form provider so the widget never reaches into FormValues or the schema directly.
Constructors
-
FieldState({required Object? value, required ValueChanged<
Object?> onChanged, String? error, Map<String, String> errors = const {}, bool enabled = true, Future<OptionsPage> searchOptions(String query)?, Future<OptionsPage> searchOptionsFor(String field, String query)?, FilamentFilePicker? filePicker, Future<void> uploadFile({required List<int> bytes, required String filename})?, MediaSet? media, FilamentStrings strings = const FilamentStrings()}) -
const
Properties
- enabled → bool
-
final
- error → String?
-
final
-
errors
→ Map<
String, String> -
The form's whole error map, keyed the way
client_validator.dartand a server422both key it:'<name>'for a flat field, and'<name>.<row>.<child>'for a row nested inside a repeater. error above is this field's own entry, already looked up for convenience — every non-repeater widget ignores errors entirely, the same as filePicker and uploadFile are file-only. OnlyRepeaterFieldWidgetreads it, to put a row's own error on that row instead of folding it into one message for the whole field.final - filePicker → FilamentFilePicker?
-
Picks a file for a
FileComponent; null when the host gaveResourceFormScreenno picker, which isFileFieldWidget's signal to stay inert rather than render a control it cannot drive. Every other field type ignores it, the same as searchOptions.final - hashCode → int
-
The hash code for this object.
no setterinherited
- media → MediaSet?
-
The record's resolved media for this field, when the record carried a
'<name>.__media'sibling — null on create, and null for every non-file field, the same as filePicker and uploadFile. A stored value that matches one of these items byuuiddisplays that item's name and thumbnail instead of the raw token; seeFileFieldWidget.final -
onChanged
→ ValueChanged<
Object?> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
searchOptions
→ Future<
OptionsPage> Function(String query)? -
Fetches this field's options for a query, when
/schemapublished anoptionsUrlinstead of inlining them.final -
searchOptionsFor
→ Future<
OptionsPage> Function(String field, String query)? -
The per-field variant of searchOptions, for the one caller that
cannot use it: a container field whose children each need a lookup
bound to the CHILD's own name. searchOptions is a closure already
bound to the field it was built for, and a closure cannot be rebound —
handing a repeater's searchOptions to a row's select would query the
repeater's own name, which the options endpoint rightly refuses. A
container (today only
RepeaterFieldWidget) calls this with the child's name instead; leaf fields keep reading searchOptions, and a form that never nests a remote select inside a repeater can ignore this entirely.final - strings → FilamentStrings
-
Labels for
FileFieldWidget's choose control, in-flight state and unavailable note. Defaulted, not optional, like every other host-facing string in this package — every non-file field ignores it.final -
uploadFile
→ Future<
void> Function({required List<int> bytes, required String filename})? -
Uploads bytes for the field this state belongs to and applies the
outcome — value on success, error on failure — through the owning
provider.
FileFieldWidgetonly ever calls this after filePicker itself returned non-null, so a caller that never sets filePicker has no reason to set this either; seeResourceFormScreen._field().final - value → Object?
-
final
Methods
-
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