Premium

Habit Tracker with SQLite

A streak is a claim about consecutive days, and the boundary cases are where every naive counter breaks.

  • Flutter
  • Dart
  • SQLite

About this project

Add habits, check them off daily, and see a current streak, an all-time best, and a calendar heatmap per habit — backed by real SQLite via sqflite_common_ffi, the project’s one justified dependency.

The idea it is built around is that a streak is a specific claim — consecutive days, ending at today or yesterday — and getting the boundary cases right is where every naive counter breaks. What happens the moment you check in today. What a missed day does (resets to zero, not to one). Why the all-time best is stored separately rather than recomputed by eyeballing history, and what happens to it when you undo today’s check-in right after it sets a new record. Fifty tests cover this directly against a real database, not a mock.

The project ships as Dart source only — lib/, test/, pubspec.yaml — deliberately without the hundreds of lines of generated Android and Windows platform boilerplate flutter create would normally add. One documented command regenerates both, verified in the README to leave the real source untouched.

What you will learn

  • Get the streak boundary cases right: today, a missed day, the all-time best, and why they need separate storage
  • Use real SQLite via sqflite_common_ffi on desktop, justified as the project’s one dependency
  • Understand why a query surface — "every habit with a streak over 7" — is the reason to reach for SQL at all
  • Read and write tests that assert against a real database, not just an in-memory fake
  • See a const constructor stop a rebuild, and confirm it by counting builds rather than assuming

Before you start

  • Some Flutter — widgets, state, a list view
  • Flutter 3.19+ and Dart. The project ships as Dart source only; the README gives the one command that regenerates the platform folders.

Academic integrity notice

These projects are provided for learning, experimentation and reference. Understand the code, modify it for your own requirements, and acknowledge external work according to your institution’s academic policies. Priodemy does not supply work to be submitted as your own.