mvc_pattern library
This library contains the classes necessary to develop apps using the MVC design pattern separating the app's 'interface' from its 'business logic' and from its 'data source' if any.
Code samples can be found in the following links: https://github.com/AndriousSolutions/mvc_pattern/tree/master/test https://github.com/AndriousSolutions/mvc_pattern/blob/master/example/lib/main.dart
Classes
- AppConMVC
- A Controller for the 'app level' to influence the whole app. Full overview of mvc_pattern can be found in this article: https://medium.com/follow-flutter/flutter-mvc-at-last-275a0dc1e730
- AppMVC
- Main or first class to pass to the 'main.dart' file's runApp() function. AppStatefulWidget is its subclass.
- ControllerMVC
- Your 'working' class most concerned with the app's functionality. Add it to a 'StateMVC' object to associate it with that State object.
- ModelMVC
- This class is to be concerned with the data It is accessed by the Controller but can call setState() as well.
- SetState
- Used like the function, setState(), to 'spontaneously' call build() functions here and there in your app. Much like the Scoped Model's ScopedModelDescendant() class. More information: https://medium.com/flutter-community/shrine-in-mvc-7984e08d8e6b#488c
-
StateMVC<
T extends StatefulWidget> - The State Object seen as the 'View of the State.' Uses the mixins: WidgetsBindingObserver, _ControllerList, _StateListeners
- StateSetter
- Allows you to call 'setState' from the 'current' the State object.
- Uuid
- A UUID generator, useful for generating unique IDs. Shamelessly extracted from the author of Scoped Model plugin, Who maybe took from the Flutter source code. I'm not telling!
-
ViewMVC<
T extends StatefulWidget> - The StatMVC object at the 'app level.' Used to effect the whole app.
Mixins
- StateListener
- Responsible for the event handling in all the Controllers, Listeners and Views.
- StateSets
- Record in a Set any previous State objects and the current State object being used.
Typedefs
-
BuilderWidget<
T extends Object> = Widget Function(BuildContext context, T? object) - The 'type of function' required by the class, SetState.