maac_mvvm_with_get_it library

Classes

BaseViewModelState<T extends ViewStatefulWidget>
BaseViewModelState is an abstract class for managing the state of a widget that needs visibility detection and dependency injection using GetIt. This class leverages a unique visibility detector key for each instance, enabling scoped dependency management based on visibility changes.
DependencyViewModelsWidget
An abstract widget that is tied to multiple ViewModels, managed via GetIt. This widget automatically handles the lifecycle of the ViewModels within a GetIt dependency injection scope.
DependencyViewModelWidget<T extends ViewModel>
An abstract widget that is tied to a single ViewModel, managed via GetIt. This widget automatically handles the lifecycle of the ViewModel within a GetIt dependency injection scope.
FutureUseCase<Result, Param>
LifecycleComponent
The abstract base class for a ViewModel with lifecycle callbacks in Flutter.
LifeCycleManager
MediatorStreamData<T>
StreamData<T>
A StreamData class used when updating data state from ViewModel to Widget.
StreamDataConsumer<Data>
A stateless widget that listens to a stream of data (StreamData) and rebuilds the UI each time new data is emitted. It uses a DataConsumerBuilder function to build the UI with the updated data.
StreamDataViewModel<T>
The StreamDataViewModel class is used when initializing StreamData while binding it with ViewModel.
StreamUseCase<Result, Param>
UseCase<Result, Param>
ViewModel
A class that manages the logic state of a widget and binds it to the widget's lifecycle.
ViewModelsWidget
ViewModelWidget<T extends ViewModel>
ViewState<T extends ViewStatefulWidget>
ViewStatefulWidget
WrapperContext

Properties

injectViewModel ↔ GetIt
create viewmodel instance from registerViewModel by _sl.get
getter/setter pair

Functions

executeCondition(bool condition, dynamic invoker()) → dynamic
getViewModel<T extends ViewModel>({dynamic param1, dynamic param2, String? instanceName, Type? type}) → T
registerViewModel<T extends ViewModel>(T factoryFunc(), {String? instanceName}) → void
register viewmodel instance to GetIt with _sl custom instance
resetViewModelSL() Future<void>

Typedefs

DataConsumerBuilder<Data> = Widget Function(BuildContext context, Data data)
A typedef for a builder function that is used to create a widget that consumes data from a stream. The builder function is called each time new data is emitted by the stream.