Skip to content

duyhuynh258/simple-todo

Repository files navigation

Simple Todo App

coverage style: very good analysis License: MIT

Generated by the Very Good CLI 🤖

Source code explanation

Features:

  • Sign In with google, sign up with email, verify email, reset password, logout (firebase).
  • Add / complete / uncompleted tasks.
  • Save tasks to local database.
  • Auto save when creating/updating tasks
  • Home UI with three screens for uncompleted(todo), completed (done) and all tasks.
  • Delete tasks.
  • Sync with firebase.
  • Light/Dark theme (50% done).

Environments, dependencies & references:

  • Flutter version 2.5.0 null-safety.
  • Use Android Studio as IDE.
  • Use fvm for multiple flutter versions.
  • Flutter project generated by Very Good CLI.
  • Remote database Firebase FireStore.
  • Authenticating using Firebase.
  • Local database Sembast.
  • UI color theme refers to published app “Đại Chiến 360”
  • Heavily depends on freezed package for code generation.
  • Architecture refers to Resocoder tutorials.
  • Use flutter_bloc package for state management.
  • Use RepositoryProvider (flutter_bloc package) for DI.
  • Use dartz package for functional programming.

Major decision making:

  1. Why choose another local database instead of FireStore offline?
  • If we use Firestore as an out-of-the-box solution, whenever we face corner cases, we will need to wait for their support, hopefully the problem could be solved. In the future, we can move our remote database to another NoSQL database easily. Which is not possible if we use an out-of-the-box FireStore offline solution.
  1. Why choose Sembast?
  • Sembast uses concepts that are very familiar with FireStore. It could help us boost the project faster.
  1. Why use code generation?
  • With supporting union type, deep comparison, auto immutable data class, and tons of other things that help improve project productivity, it’s worth it.
  1. Why choose Bloc for state management?
  • I have more experience with Bloc. Also, some features of the project would need streams, that is what Bloc does better than just Provider or StateNotifier.

Architecture:

Using clean architecture to organize code base into Domain, Presentation, Application and Infrastructure layer.

Unit Testing cases:

  • Empty tasks will not be saved (bloc test).
  • Can only create one empty draft task at one time (bloc test).
  • Test TaskWatcherBloc when completed / uncompleted task (bloc test).

Widget Testing cases:

  • Pump widget supports DI for mocks.
  • Create task button will hide when creating or editing tasks.
  • Tasks will not show duplicated in one screen.
  • Task will display on the right screen regarding status.

Getting Started 🚀

This project contains 3 flavors:

  • development
  • staging
  • production

To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands:

# Development
$ flutter run --flavor development --target lib/main_development.dart

# Staging
$ flutter run --flavor staging --target lib/main_staging.dart

# Production
$ flutter run --flavor production --target lib/main_production.dart

*Simple Todo App works on iOS, Android, and Web.


Running Tests 🧪

To run all unit and widget tests use the following command:

$ flutter test --coverage --test-randomize-ordering-seed random

To view the generated coverage report you can use lcov.

# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
$ open coverage/index.html

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages