LiteFormController class

Inheritance

Constructors

LiteFormController.new()

Properties

config LiteFormsConfiguration?
no setter
hashCode int
The hash code for this object.
no setterinherited
isLoading bool
no setterinherited
isLocalStorageInitialized bool
no setterinherited
preserveLocalStorageOnControllerDispose bool
preserveLocalStorageOnControllerDispose if true, the values you saved using setPersistentValue will be preserved despite of the controller's lifecycle
finalinherited
repo LiteRepo?
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useLocalStorage bool
useLocalStorage whether to use a local storage (based on Hive or not)
finalinherited

Methods

changeRemoveState({required String formName, required String fieldName, required bool isRemoved}) → void
checkAlwaysValidatingFields({required String formName}) → void
clearForm(String formName) → void
clearPersistentData({bool forceReBuild = false, bool forceClearLocalStorage = false}) Future
forceReBuild if true, it will call rebuild() after the data is cleared. forceClearLocalStorage makes sense only if you set preserveLocalStorageOnControllerDispose to true for your controller. This flag will clear your local storage
inherited
configureLiteFormUI({LiteFormsConfiguration? config}) → void
createFormIfNull({required String formName, required bool autoRemoveUnregisteredFields, FormState? formState}) → void
this method registers a new form if it was not created previously
delay(int millis) Future
It's just a utility method in case you need to simulate some loading or just wait for something
inherited
getAllFieldsOfForm({required String formName, bool mountedOnly = false, bool includeIgnored = false}) Iterable<FormGroupField>
mountedOnly if true, this will return only the fields that are currently mounted into a widget tree
getFormData({required String formName, required bool applySerializers}) Future<Map<String, dynamic>>
getIsLoading(String? loaderName) bool
inherited
getPersistentList<TGenericType>(String key) List<TGenericType>?
inherited
getPersistentValue<TType>(String key) → dynamic
Retrieves a persistent data stored in SharedPreferences You can use your own types here but in this case you need to add json encoders / revivers so that jsonEncode / jsonDecode could understand how to work with your type
inherited
isFieldInitiallySet({required String formName, required String fieldName}) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFormDisposed({required String formName, required bool autoDispose}) → void
onLocalStorageInitialized() → void
called when the local storage has loaded all stored values. Override it if you need to get some values from local storage
override
onValueChanged({required String formName, required String fieldName, required Object? value, required String? view, bool isInitialValue = false}) → void
view is a String that will be displayed to a user. This must be null for text inputs since they are updated on user input but for other inputs e.g. a LiteDatePicker this must be a formatted date representation
rebuild() → void
inherited
registerFormFieldIfNone<T>({required String formName, required String fieldName, required String? label, required LiteFormValueSerializer serializer, required List<LiteValidator>? validators, required AutovalidateMode? autovalidateMode, required InputDecoration? decoration}) FormGroupField<T>
Registers a form field for a specified form. If the form field is already registered, it does nothing
reset() → void
override
setIsLoading(String? loaderName, bool value) → void
inherited
setPersistentList<TGenericType>(String key, List<TGenericType> values) Future
inherited
setPersistentValue<TType>(String key, TType? value) Future
inherited
startLoading() → void
inherited
stopAllLoadings([List<String>? except]) → void
just sets all loader flags to false but doesn't actually stop any loaders except if, for some reason you want to keep some loaders running, just pass their names here
inherited
stopLoading() → void
inherited
toString() String
A string representation of this object.
inherited
tryGetField({required String formName, required String fieldName}) FormGroupField?
tryGetValueForField({required String formName, required String fieldName, bool applySerializer = false}) FutureOr<Object?>
This is required to be able to keep form up to date For example you might have remove some fields from a form because of some user's actions then we don't have to validate them any more A real use case: User selects a MALE gender but you had Pregnancy status drop selector and you want to remove it for a male. There is not need to validate it but the form has this field already registered
updateBrightness(Brightness value) → void
validateForm({required String formName}) Future<bool>

Operators

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