The project is made with Flutter a Google UI framework created in 2017. It uses the Google back-end language Dart created in 2011, Dart
The application is based on a MVVM architecture using Stacked by FilledStacks as a state management. The usage of Stacked is for maintainability and readability. Stacked uses implicitly the Provider package.
As previously said, MoodyDiary is relying on the Stacked package. The main idea is to use an MVVM pattern to remove any business logic from the UI layouts by putting this logic in a separated view model. This adds more clarity and maintainability.
We can decompose the project into 4 layers: the Models, The Views, and finally the ViewModels.
In the project, the views are for display only.
They can trigger interactions through Buttons/GestureDetector/Events that will call ViewModel methods.
The ViewModel class can extend different types of abstract ViewModels such as:
- BaseViewModel
- ReactiveViewModel
- FutureViewModel
- And many more, but we mostly use those ones, you can refer to the stacked documentation
The ViewModel data-bind all the data from the services and models and create getters for the view and notify the view of any changes (using a ReactiveServiceMixin or a NotifyListeners)
- Install the Flutter SDK following the official documentation
Then use the
flutter doctorto verify your install - Clone the project.
- Run the
flutter pub getcommand to fetch the dependencies needed to build the project. - Use the
flutter pub run build_runner build --delete-conflicting-outputsto generate the GetIt config. - Create a
.envfile containing theAPPWRITE_ENDPOINT&APPWRITE_PROJECT_IDenv variable. - Finally, use the
flutter runcommand to launch your app on your device.
- (In case of later use of Firebase solution =>) using a M1/M1Pro/M1Max Apple Silicon chip, you may face a compiling error about the Class
AMSupportURLConnectionDelegateorAMSupportURLSessionClass being implemented twice:
=> Be sure you have the good apple profile in your XCode Proj.
=> Be sure that you are opening terminal using Rosetta and not with ARM/Native
=> Run this command:flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace && flutter run