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
CleanView
The CleanView represents a StatefulWidget. The CleanView is typically a page or screen in the application. However, a CleanView can be any StatefulWidget. The CleanView must have a State, and that State should be of type ViewState<MyView, MyController>.
CleanViewState<ViewPage extends CleanView, Con extends Controller>
The CleanViewState represents the State of a StatefulWidget, typically of a screen or a page. The CleanViewState requires a Controller to handle its events and provide its data.
CompletableFutureUseCase<Params>
A streamlined UseCase that performs a task without returning a value.
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 CleanView. However, it is preferable to be contained inside the CleanView for readability and maintainability.
FlutterCleanArchitecture
FutureUseCase<T, Params>
A streamlined UseCase for single-shot requests that don't need streams. It executes a single Future and maps the result to Observer callbacks.
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<ViewPage extends CleanView, 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

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.