This project is a starting point for a Flutter application.
Here are a few resources to get you started if this is your first Flutter project:
For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
We use Mason to generate clean code easily. You can refer to the package complete documentation.
You can use the page template in this way:
# ๐ฏ Activate from https://pub.dev
dart pub global activate mason_cli
Now you can call the mason
command in the terminal
Get all bricks registered in mason.yaml
via:
mason get
Go to the folder where you want to create the new page
cd lib/pages
Run the command
mason make page
Insert the name of the page, and you're done ๐
State management: Get
A Store is where data and app state are retained.
App-level state and data reside in /lib/store in *.service file.
Services are initialized at the app's start and can be retrieved from everywhere with the ServiceClassName.to
method.
A Service is often bound to a Model that matches a database object.
Ex. BreedService stores data about BreedModel, like the list of breeds.
A Model contains methods to transform JSON data to the class object.
A .selector file helps to keep the model's file clean and to keep variables private.
.api file is a collection of methods that make REST calls about the model.
APIs should not be called directly from Widgets. Actions should be used instead.
The actions are an extension of the Service and are a collection of methods that call APIs and process data into models.
App routes.
A .page file contains the route definition and Binding with the Controller.
When calling Get.toNamed
the Controller is automatically initialized.
The Controller is responsible for the page logic.
The Controller is similar to a Service, but it's responsible only for its page and gets created and destroyed with it. It retrieves data from Services for the Widget and makes API calls through Service's Actions.
High-level widget that defines Page layout and content.
Widget content is reactively updated using Obx Widget
Low-level widgets and UI tokens
Design tokens point to style values like colors, fonts, and measurements
Lowest-level widgets like structure widgets and buttons.
Medium-level widgets are composed of many lower-level widgets.
Get package is used for translations
*.translations files are used where a string needs to be translated.
All .translations files are then merged in utils/translations.dart.
This could lead to some repetition and overwriting, but it keeps translations organized and easier to track.