Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexisl61/fluttertemplate
My personal template when starting a new flutter project
https://github.com/alexisl61/fluttertemplate
flutter template viewmodel
Last synced: 22 days ago
JSON representation
My personal template when starting a new flutter project
- Host: GitHub
- URL: https://github.com/alexisl61/fluttertemplate
- Owner: AlexisL61
- Created: 2024-08-16T15:51:37.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-11-04T14:01:44.000Z (2 months ago)
- Last Synced: 2024-12-12T17:12:34.674Z (24 days ago)
- Topics: flutter, template, viewmodel
- Language: C++
- Homepage:
- Size: 274 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# flutter_template
My personal template when starting a new flutter project. It includes a dependency injection system (get_it), a folder architecture and a model-viewmodel-view implementation for flutter.
## Quick start
- Launch with provider Dummy : `flutter run -t ./lib/main_dummy.dart`
- Launch with provider Live : `flutter run -t ./lib/main_live`## Providers
This template use two providers to split the repositories in case you are not in the same environment. There are two providers that are not implemented :
- Live : Which take a baseUrl to communicate with an api
- Dummy : Which use static string to simulate the communication to the apiTo split this behavior, each provider instantiate their own repositories in their provider file (dummy will instantiate the DummyExampleRepository and live will instantiate the LiveExampleRepository).
## Folders
### Components
Components are used to store small widget that can be reused by any page or dialog of the app.
They can be either :
- An atom : A small widget
- A molecule : A widget containing atoms
- An organism : A widget containing moleculesIf a component behavior become too big, there should be a ViewModel with it
### Model
The model contains every data class and the core concept of the Model-View-ViewModel.
### Pages
Pages contains every pages of the app. It's a screen the user will see containing components and specific widget
Every pages should at least have a ViewModel.
### Providers
The providers help you splitting your code behavior depending of the environment.
### Repositories
Every repository give you a way to retrieve data and create data class with it. They can only be called from Services.
### Services
Every services helps you calling repositories and transformers to retrieve data as you want.
### Transformers
Transformers let you transform data, from one class to an another. They can only be called from Services.
### Utils
Utils contain every extensions for the project. It can be extensions for base class (e.g. string, int, boolean) and for specific classes too.
## Diagram
```mermaid
flowchart LR
Page
ViewModel
Component
Service
Transformer
Repository
DataClass[Data class]
Page<-->ViewModel
Page<-->Component
ViewModel-->Service
Service-->Transformer
Service-->Repository
Component .->ViewModel
Repository-- Create -->DataClass
Transformer-- Transform -->DataClass
```