SunnyFormController<T> class abstract

Implemented types
Mixed in types
  • LoggingMixin
  • Disposable
Implementers
Available Extensions

Constructors

SunnyFormController.base(BuildContext buildContext, Map<JsonPath, FormFieldValidator>? validators, dynamic name)

Properties

autofocusNode FocusNode?
Returns the focusNode that should be autofocused based on the current form state. It's generally the first required form field that doesn't have a value
no setteroverride
buildContext BuildContext
The build context for the form
final
context → ReactiveContext
Override this method to use a custom context.
no setterinherited
errors → SunnyObservableMap<JsonPath, ValidationError?>
An observable map of errors
final
formState → SyncStream<SunnyFormState>
A stream of any change to the state of this form.
final
hashCode int
The hash code for this object.
no setteroverride
isModified bool
Whether the user has made changes to the form.
no setteroverride
lastFocusNode FocusNode?
The last focus node that was added
no setteroverride
log → Logger
no setterinherited
loggerName String
no setterinherited
name String
Helpful for debugging - displays the name of the record being edited, for example
final
parent FormController?
The parent form
no setteroverride
readyChecks Map<JsonPath, SafeCompleter>
Consumers can request a completer that's used to prevent submission until the child component is ready - maybe they are uploading a file or something.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<Attribute>
observes all changes
no setteroverride
validators Map<JsonPath, FormFieldValidator>
Validators run during the validation phase of the submission.
final

Methods

addError(JsonPath path, ValidationError? error, {AttributeSource source = AttributeSource.model}) → void
Registers an error at this path
override
addFocusNode(JsonPath path, FocusNode? newFocusNode) → void
Adds a focusNode to this form at this path
override
autofocus([BuildContext? context]) → void
override
clearError(JsonPath path, {required AttributeSource source}) → void
Removes all errors at this path
override
clearErrors({required AttributeSource source}) → void
Clears out all errors
override
dispose() Future
override
disposeAll() Future
inherited
endSubmission() → void
Ends this form's submission process
override
focusLast([BuildContext? context]) → void
override
get<X>(JsonPath path) → X?
Retrieves a value from the underlying data model.
override
getFocusNode(JsonPath path, {bool createIfMissing = true}) FocusNode?
Retreives a focus node for the specified path
override
invalidateReadyCheck(JsonPath path) → void
Unregisters a ready check at the given path. (should this also complete any outstanding item?)
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
observePath<X>(JsonPath path) Stream<X?>
Observes a single path
override
path<X>(JsonPath<X> path, [Attribute<X>? attr]) → X?
Uses the type from the JsonPath
override
put(JsonPath path, dynamic value, {required AttributeSource source}) → void
Put is like set, but it's not assumed that the data has been sanitized
override
registerDisposer(Disposer callback) → void
inherited
registerForm(FormController? form) → void
Registers a subform
override
registerFormValidator(String key, FormValidator? validator) → void
Registers a form validator
override
registerStream(Stream? stream) → void
inherited
registerSubmitHook(String key, SubmitHook? onSubmit) → void
Registers a submit hook. These run after validation
override
registerSubscription(StreamSubscription? subscription) → void
inherited
removeDisposer(FutureOr dispose()) → void
inherited
requestReadyCheck(JsonPath path) → SafeCompleter
Gets or puts a ready check at the given path
override
set(JsonPath path, dynamic value, {AttributeSource source = AttributeSource.model}) → void
Sets a value in the underlying model
override
startSubmission() → void
Begins this forms submission process
override
submit<X>(BuildContext context, {FutureOr<X?> submit()?, bool? skipIfUnmodified}) FutureOr<FormSubmitResult<X>>
Submits this form, including subforms, and returns the result
override
toString() String
A string representation of this object.
inherited
unregisterForm(FormController form) → void
Unregisters a subform
override
unregisterFormValidator(String key) → void
Unregisters a validator
override
unregisterSubmitHook(String key) → void
Unregisters a submit hook
override
updateErrors(List<ValidationError> validationErrors, {required AttributeSource source}) → void
Clears and sets a list of validationErrors
override
validate({required bool skipIfUnmodified}) FutureOr<Map<JsonPath, List<ValidationError>>>
Validates this form and any subforms. An empty result means that the form validated successfully
override
validatePath(JsonPath path) String?
override

Operators

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

Static Methods

ofMap(BuildContext context, Map<String, dynamic> map, {Map<JsonPath, FormFieldValidator>? validators, required dynamic name}) MapForm
override
ofModel<T extends MModel>(BuildContext context, T model, {Map<JsonPath, FormFieldValidator>? validators}) MModelForm<T>
override
ofMSchema<T extends MModel>(BuildContext context, T model, IMSchemaDefinition definition, {Map<JsonPath, FormFieldValidator>? validators}) FormController
override
ofMSchemaFuture<T extends MModel>(BuildContext context, T model, {MSchemaRef? mtype, Map<JsonPath, FormFieldValidator>? validators}) Future<MSchemaForm<T>>
override
singleValue<T>(BuildContext context, SingleValue<T> container, {Map<JsonPath, FormFieldValidator>? validators, required dynamic name}) SingleValueForm<T>
override