Flutter architecture

Project architecture (Clean Architecture Approach)

* We want to determine what types of database that we use for storage (might want to change it later on)
* We want to adhere to SOLID principles since we are using OOP for this project.
* We want to ensure that UI layers do not care what is going on at the data layer at all.
* We might want to separate each layer into different packages.
* Widgets
* BLoC
* Bloc only manages UI state based on business logic
* Repositories (interfaces aka idea how the logic would behave)
* Entities (or models that UI needs)
* Usecases (user stories)
* Typically one function, but can be more if functions are related.
* Remember, one class has one responsibility only.
* source
* remotes (API)
* locals (Database)
* model
* request
* response
* Repositories (Implementation from Domain layer)

DI pattern

* Declare the modules used in the project.
* All modules must extend "DIModule"
* The registers must be set in the func provides.
* When you want to call 1 DI just use the syntax. "getIt<My Component>()"
* Learn more about "get_it"

Routes

* All routes must extend this class.
* When extending, you will have to override func "initRoute", here you will define your routes.
* A feature may have multiple routes with different input arguments.
* Make sure that the ID of each route in your project is unique.
*  To add a route to the project you just need to declare in the func "generateRoute". Each route will be provided with a func "build", you must call it in the func "generateRoute" of "manifest" to register.

Network.

* Project can use retrofit to work with the alternative network for http.
* Retrofit is pre-installed in the "ApiModule.dart". You can customize it here
* All interceptors are defined in the lib/config/src/interceptor/* class
* To work with Certificate, please refer to the "lib/config/src/http_overrides.dart" class, with the default the project accept badCertificate

Development environment settings.

* All flavor environments are installed in the "/lib/config/src/buid_config.dart" class.
* Basically we are defining 4 development environments: development, staging, preprod and release.
* Run App
## development: flutter run -t lib/main.dart --debug --flavor development## staging: flutter run -t lib/main.dart --debug --flavor staging## preprod: flutter run -t lib/main.dart --debug --flavor preprod
## development: flutter build apk -t lib/main.dart --flavor development## staging: flutter build apk -t lib/main.dart --flavor staging## preprod: flutter build apk -t lib/main.dart --flavor preprod
## development flutter build ios -t lib/main.dart --flavor development## staging: flutter build ios -t lib/main.dart --flavor staging## preprod: flutter build ios -t lib/main.dart --flavor preprod

resources

* All resources (images, fonts, videos, ...) must be placed in the assets class
* Before using them, please declare the path in utility class and the suffix of the class to be type_provide (image_provide.dart)

Getting started

npm run init

Json parsing / serialization

flutter pub run build_runner build
npm run generate

Indentation.

Localization

Setup Step :

flutter pub global activate intl_utilsflutter pub global run intl_utils:generate

Initialize plugins (IntelliJ reference)

--

--

Senior Mobile Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store