flutter_clean_architecture library

Classes

BackgroundUseCase<T, Params>
A specialized type of UseCase that executes on a different isolate. The purpose is identical to UseCase, except that this runs on a different isolate. A BackgroundUseCase is useful when performing expensive operations that ideally should not be performed on the main isolate.
BackgroundUseCaseMessage<T>
Data structure sent from the isolate back to the main isolate
BackgroundUseCaseParams<T>
Data structure sent from the main isolate to the other isolate
CompletableUseCase<Params>
A special type of UseCase that does not return any value. This UseCase only performs a task and reports either success or failure. A good candidate for such a UseCase would be logout or login.
ControlledWidgetBuilder<Con extends Controller>
This is a representation of a widget that is controlled by a Controller and needs to be re-rendered when Controller.refreshUI is triggered.
Controller
A Clean Architecture Controller. Should be aggregated within a ViewState or a View. However, it is preferable to be contained inside the View for readability and maintainability.
FlutterCleanArchitecture
Observer<T>
An Observer used by the Presenter to subscribe to a UseCase. Ideally, it would be implemented as an inner class inside the Presenter. But, until Dart supports inner classes, this is a workaround.
Presenter
A Presenter prepares data for the Controller, listens to UseCase, and handles its creation and distruction. A Presenter should be aggregated inside a Controller. Its dependencies are also provided by the Controller. Once the Controller is disposed, it should also call dispose() of the Presenter in order to dispose of the UseCase. The Presenter utilizes an Observer to listen to the UseCase. However, it is a separate class since Dart does not yet support inner or anonymous classes.
ResponsiveViewState<Page extends View, Con extends Controller>
The ResponsiveViewState represents the State of a StatefulWidget, typically of a screen or a page. The ResponsiveViewState requires a Controller to handle its events and provide its data.
UseCase<T, Params>
The abstract UseCase to be implemented by all usecases. T Is the type to be returned by the UseCase to the Presenter Params Is the object passed to the usecase containing all the needed parameters for the UseCase
View
The View represents a StatefulWidget. The View is typically a page or screen in the application. However, a View can be any StatefulWidget. The View must have a State, and that State should be of type ViewState<MyView, MyController>.
ViewState<Page extends View, Con extends Controller>
The ViewState represents the State of a StatefulWidget, typically of a screen or a page. The ViewState requires a Controller to handle its events and provide its data.

Typedefs

ControlledBuilder<Con extends Controller> = Widget Function(BuildContext context, Con controller)
UseCaseTask = void Function(BackgroundUseCaseParams backgroundUseCaseParams)
ViewBuilder = Widget Function(BuildContext context)
Defines a function type that receives a BuildContext and returns a Widget for widget builders.