Naming convention To reduce the effort needed to read and understand source code
- variable : camelCase
- class name: (upper) CamelCase
- Folder name: snake_case
- Use english!
Data Flow
- View -> PageEvent -> Bloc -> Repository -> Network/Sqlite or Both -> Bloc -> PageState -> View
- View -> PageEvent -> Bloc -> Repository -> Network/Sqlite or Both -> Bloc -> PageState -> Future -> View
Basic rules:
- lib/pages: ui only, no logic app allowed
- lib/bloc: logic only: no widget, no context, no access data directly.
- lib/data: maintain and access data.
- lib/data/repositories/ : I/O data that needed in this repository
- lib/data/repositories_impl/ : providing data. (can be fake repository)
Network
- File config url remote_constant.dart
- File penghubung http ke repository remote_datasource.dart
- Custom httpnya di http_client.dart
Database(Sqlite)
- create script table in database.dart
- create class Dao extending BaseDao
- add dao di injector_config.dartk
- run common.injector generator
- implement di repository
Kiwi Injector note: -Add class in injector_config.dart /////////////////////////////////////////////////// flutter packages pub run build_runner build /////////////////////////////////////////////////// Note: On first attempt to run this command you might encounter a conflict error. If so, please add the --delete-conflicting-outputs argument to your command: ///////////////////////////////////////////////////////////////////////////////////// flutter packages pub run build_runner build --delete-conflicting-outputs /////////////////////////////////////////////////////////////////////////////////////
-json to model : https://javiercbk.github.io/json_to_dart/
HOW TO RUNING THIS PROJECT
install flutter 2.10.5 pub get run this code in terminal -> flutter packages pub run build_runner build --delete-conflicting-outputs run apps