An open API service indexing awesome lists of open source software.

https://github.com/blkkkbvsik/moody_diary

A basic auth using Flutter with Stacked state management and Appwrite.io as BackOffice
https://github.com/blkkkbvsik/moody_diary

Last synced: 3 months ago
JSON representation

A basic auth using Flutter with Stacked state management and Appwrite.io as BackOffice

Awesome Lists containing this project

README

        

# Summary

- [MoodyDiary](#moodydiary)
- [Current architecture](#current-architecture)
- [Initialisation/Requirement](#initialisation-requirement)
- [Troubleshooting](#troubleshooting)

### MoodyDiary

The project is made with [Flutter](https://flutter.dev/) a Google UI framework created in 2017.
It uses the Google back-end language Dart created in 2011, [Dart](https://dartlang.org/)

The application is based on a MVVM architecture using [Stacked](https://pub.dev/packages/stacked) by FilledStacks as a state management.
The usage of [Stacked](https://pub.dev/packages/stacked) is for maintainability and readability.
[Stacked](https://pub.dev/packages/stacked) uses implicitly the [Provider](https://pub.dev/packages/provider) package.

### Current architecture

As previously said, MoodyDiary is relying on the [Stacked](https://pub.dev/packages/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](https://pub.dev/packages/stacked#baseviewmodel-functionality)
- [ReactiveViewModel](https://pub.dev/packages/stacked#reactiveviewmodel)
- [FutureViewModel](https://pub.dev/packages/stacked#futureviewmodel)
- And many more, but we mostly use those ones, you can refer to the [stacked documentation](https://pub.dev/documentation/stacked/latest/stacked/stacked-library.html#classes)

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)

### Initialisation Requirement

1) Install the Flutter SDK following the [official documentation](https://flutter.dev/docs/get-started/install)
Then use the `flutter doctor` to verify your install
2) Clone the project.
3) Run the `flutter pub get` command to fetch the dependencies needed to build the project.
4) Use the `flutter pub run build_runner build --delete-conflicting-outputs` to generate the [GetIt](https://pub.dev/packages/get_it) config.
5) Create a `.env` file containing the `APPWRITE_ENDPOINT` & `APPWRITE_PROJECT_ID` env variable.
4) Finally, use the `flutter run` command to launch your app on your device.

### Troubleshooting

* (In case of later use of Firebase solution =>) using a M1/M1Pro/M1Max Apple Silicon chip, you may face a [compiling error](https://stackoverflow.com/questions/65089767/class-amsupporturlconnectiondelegate-is-implemented-in-both) about the Class `AMSupportURLConnectionDelegate` or `AMSupportURLSession` Class 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](https://medium.com/codex/simple-way-to-use-cocoapods-on-m1-ac9e22cf7e1c)
=> Run this command: ```flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace && flutter run```