SmartFormKey class final
A key that provides imperative access to a mounted SmartForm.
- Inheritance
-
- Object
- Key
- GlobalKey<
SmartFormState> - SmartFormKey
Constructors
- SmartFormKey()
- Creates a unique key for one SmartForm.
Properties
- currentContext → BuildContext?
-
The build context in which the widget with this key builds.
no setterinherited
- currentState → SmartFormState?
-
The State for the widget in the tree that currently has this global key.
no setterinherited
- currentWidget → Widget?
-
The widget in the tree that currently has this global key.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
values
→ Map<
String, Object?> -
Returns an immutable snapshot of current registered field values.
no setter
Methods
-
clearErrors(
) → void - Clears all validation and server errors.
-
focusField(
String name) → Future< void> -
Scrolls to and focuses field
name. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patchValue(
Map< String, Object?> values) → void - Changes multiple field values after validating every supplied name.
-
reset(
) → void - Restores every field to its initial value and clears its state.
-
scrollToField(
String name) → Future< void> -
Scrolls field
nameinto view without changing focus. -
setErrors(
Map< String, String> errors, {bool scrollToFirstError = false}) → Future<void> -
Applies backend
errorsand optionally scrolls to the first one. -
setFieldError(
String name, String error) → void -
Applies
errorto fieldname. -
setValue<
T> (String name, T? value) → void -
Changes the value of field
name. -
toString(
) → String -
A string representation of this object.
inherited
-
validate(
{bool? scrollToError, bool? focusFirstError}) → Future< SmartFormResult> - Validates every enabled field and optionally navigates to the first error.
-
valueOf<
T> (String name) → T? -
Returns field
nameasT, or null when its value is null.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited