-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
Add the needed dependencies to your Flutter project:
pubspec.yaml
dependencies:
go_mvp: ^1.0.1
object: ^1.1.1
Before continuing you should note that go_mvp
must work with 2 dependencies:
A package that provides utilities for serializing and deserializing Dart objects to and from JSON format. This library simplifies the process of converting Dart objects to JSON and vice versa, making it easier to work with JSON data in Dart applications.
Although this library is provided by
go_mvp
, it must be explicitly implemented for command line refreshing of models.
A routing package that simplifies navigation and deep linking. It provides a declarative API to define routes and manage navigation, making it easier to handle complex routing scenarios, nested navigation, and URL parameters. The package supports redirection, route guards, and a seamless integration with Flutter's state management solutions.
It is not necessary to implement this library directly,
go_mvp
provides it.
Before you start creating screens with an MVP architecture, you need to set up a few things:
pubspec.yaml
go_mvp:
baseProjectFolder: 'lib'
outputFolder: 'ui' # resulting output folder lib/ui/
modelsFile: 'data/model/generated/model.g.dart' # resulting output folder lib/data/model/generated/model.g.dart
-
baseProjectFolder
: Base project directory, commonlylib
. -
outputFolder
: Directory where the new screens will be created. -
modelsFile
: Path where theobject
class generation file is located.
Run this command for creating new screens:
dart run go_mvp:create_screen other_screen
- lib
|
| ui
|
| other_screen
|
| domain
| |
| | other_screen_state.dart
|
| model
| |
| | base_other_screen_view_model.dart
| |
| | other_screen_view_model.dart
|
| presenter
| |
| | base_other_screen_presenter.dart
| |
| | other_screen_presenter.dart
|
| view
| |
| | other_screen_page_state.dart
| |
| | other_screen_view.dart
|
| other_screen_page.dart
|
| other_screen_types.dart