FormViewModelMixin<Widget extends StatefulWidget, State> mixin

Mixin with helper methods to create form views

Superclass constraints

Properties

allDependenciesReady Observable<bool>
Observable holding value of successfull dependencies initialization
finalinherited
allPartsReady Observable<bool>
Observable indicating that all parts are connected to this instance
finalinherited
configuration DependentMvvmInstanceConfiguration
DependentMvvmInstanceConfiguration for this instance
no setterinherited
disable Observable<bool>
final
disableStream Stream<bool>
Stream of disable flags
no setter
fieldStates Map<GlobalKey<State<StatefulWidget>>, Observable<FieldValidationState>>
final
hashCode int
The hash code for this object.
no setterinherited
initialState → State
Initial state for this instance
no setterinherited
input ↔ Widget
Input for this instance
latefinalinherited
isAsync bool
Getter that returns true if instance contains async parts or require async initialization
no setterinherited
isDisposed bool
Flag indicating that this instance is disposed
getter/setter pairinherited
isFormDisabled bool
Returns true if form is currently disabled
no setter
isInitialized bool
Flag indicating that this instance is fully initialized
getter/setter pairinherited
isPaused bool
getter/setter pairinherited
requests List<BaseRequest>
Collection of requests running in this instance
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
savedStateObject Map<String, dynamic>
Model as json to be saved to cache
no setterinherited
state → State
Current State object
no setterinherited
stateFulInstanceSettings StateFulInstanceSettings
Settings for state - contains cache id and flags to await initialization if needed
no setterinherited
stateStream Stream<State>
Stream of all state updates
no setterinherited
validateFormOnSubmit bool
no setter
validators ValidatorsMap
Map of validators for current form
no setter

Methods

additionalCheck() Future<bool>
Function where you can add additional checks to form besides of registered validators
cancelAllRequests() → void
Cancels all requests in local requests collection
inherited
cancelPendingOperations() → void
Cancels all operations in current queue
inherited
canPop(BuildContext context) bool
Utility method to check if Navigator can be popped
inherited
changes<Value>(Value mapper(State state)) Stream<StoreChange<Value>>
Stream of changes (a pair of previous and current values of State) for given State mapper
inherited
checkEventWasReceived(Type event, {int? count}) bool
Returns true if underlying events list contains given event name
inherited
cleanupReceivedEvents() → void
Cleans collection of received events
inherited
connectModule<T extends InstancesModule>() → T
inherited
currentFieldState(GlobalKey<State<StatefulWidget>> key) FieldValidationState?
Current value of FieldValidationState for given field key
dispose() → void
Base method for instance dispose
override
disposeDependencies() → void
Disposes all dependencies
inherited
disposeStore() → void
Closes underlying stream subscriptions for Store and EventBus
inherited
disposeSub() → void
Closes underlying stream subscription for EventBus
inherited
enqueue({bool discardOnDispose = true, Duration? timeout, required Future<void> operation(), FutureOr<void> onTimeout()?}) Future<void>
Executes operation in sync meaning that if you wrap any code in this function the code will be executed in place if currently there are no other operations running otherwise function will add operation to queue and it will be executed after all previously executed operations are completed
inherited
ensureVisible(GlobalKey<State<StatefulWidget>> key, {double alignment = 0.3, Duration? scrollDuration}) → void
Brings view to the center of the screen
executeAndCancelOnDispose<T>(BaseRequest<T> request) Future<Response<T>>
Executes request and adds it in local requests collection
inherited
executeSubmitAction() Future<void>
Runs action when submitting form
fieldStateStream(GlobalKey<State<StatefulWidget>> key) Stream<FieldValidationState?>
Stream of FieldValidationState for given field key
getAsyncLazyLocalInstance<T extends MvvmInstance>({int index = 0}) Future<T>
Returns connected instance of given type
inherited
getFullConnectorsList() List<Connector>
Returns list of dependencies from every module and combines it with local dependencies
inherited
getFullPartConnectorsList() List<PartConnector>
Returns list of parts from every module and combines it with local parts
inherited
getLazyLocalInstance<T extends MvvmInstance>({int index = 0}) → T
Returns connected instance of given type
inherited
getLocalInstance<T extends MvvmInstance>({int index = 0}) → T
Returns connected instance of given type
inherited
initialize(Widget input) → void
Base method for instance initialization
inherited
initializeAsync() Future<void>
Base method for async instance initialization
inherited
initializeDependencies() → void
Initializes all dependencies and increase reference count in ScopedContainer
inherited
initializeDependenciesAsync() Future<void>
inherited
initializeInstanceParts() → void
Adds parts to local collection
inherited
initializeInstancePartsAsync() Future<void>
Adds parts to local collection
inherited
initializeStatefulInstance() → void
Initializes underlying Store for given State
inherited
initializeStore() → void
Initializes underlying Store for given State
inherited
initializeSub() → void
inherited
initializeWithoutConnections(Widget input) → void
Base method for lightweight instance initialization
inherited
initializeWithoutConnectionsAsync() Future<void>
Base method for lightweight async instance initialization
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<T>(EventBusSubscriber<T> processor, {bool reactsToPause = false, bool firesAfterResume = true}) EventBusSubscriber
Subscribes to event of given type
inherited
onAllDependenciesReady() → void
Runs after every async instance is initialized
inherited
onAllPartReady() → void
Runs for every async part when it is initialized
inherited
onAsyncInstanceReady(Type type, int? index) → void
Runs for every async instance when it is initialized
inherited
onAsyncPartReady(Type type, int? index) → void
Runs for every async part when it is initialized
inherited
onFirstFrame() → void
Function to be executed after first frame with WidgetsBinding.instance.addPostFrameCallback
inherited
onLaunch() → void
Function to be executed after State.initState
override
onRestore(Map<String, dynamic> savedStateObject) → void
Callback to get cache object
inherited
pauseEventBusSubscription() → void
Sets paused flag to false so events stop processing
inherited
prefillFields() → void
Prefills all field in form This is run when view model is created
removeInputFocus() → void
Utility function to remove input focus for current view
inherited
resetField(GlobalKey<State<StatefulWidget>> key) → void
Resets field state to IgnoredFieldState
restoreCachedStateAsync() Future<void>
Tries to restore cached state
inherited
restoreCachedStateSync() → void
Tries to restore cached state
inherited
resumeEventBusSubscription({bool sendAllEventsReceivedWhilePause = true}) → void
Resumes events processing
inherited
submit() Future<void>
Runs action when submitting form
subscribe() List<EventBusSubscriber>
Map of EventBus events and function to be executed for this events
inherited
toString() String
A string representation of this object.
inherited
updateFieldState(GlobalKey<State<StatefulWidget>> key, FieldValidationState state) → void
Updates FieldValidationState for given field key
updates<Value>(Value mapper(State state)) Stream<Value>
Stream of values for given State mapper
inherited
updateState(State state) → void
Updates state in underlying Store
inherited
useInstancePart<InstancePartType extends BaseInstancePart<dynamic, MvvmInstance>>({int index = 0}) → InstancePartType
Returns initialized instance part for given type
inherited
validateAllFields() Future<bool>
Runs all registered validators for this form
validateField(GlobalKey<State<StatefulWidget>> key) Future<FieldValidationState>
Validates field and updates field state
validatorForKey(GlobalKey<State<StatefulWidget>> key) Future<FieldValidationState>
Returns validator for given field key
waitTillEventIsReceived(Type event, {int? count, Duration timeout = const Duration(seconds: 1)}) Future<void>
Waits till given event is received by this instance
inherited
wrapChanges<ChangeValue, Value>({required ChangeValue changeMapper(State), required Value stateMapper(StoreChange<ChangeValue>), required Value currentMapper(State)}) StateStream<Value>
StateStream object for changes with given mapper for instance state
inherited
wrapUpdates<Value>(Value mapper(State)) StateStream<Value>
StateStream object for updates with given mapper for instance state
inherited

Operators

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