Skip to content

flutter-it/todo_it

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TodoIt - A Modern Flutter TODO App

A production-ready TODO application built with Flutter using Thomas Burkhart's PFA (Practical Flutter Architecture), featuring reactive state management with watch_it, command pattern with command_it, and local-first storage with Hive.

🎯 Project Status

Phase 1A: βœ… COMPLETE - Foundation & Business Logic Phase 1B: ⏳ Pending - UI Implementation Phase 2: ⏳ Planned - Firebase Integration


πŸ“š Documentation


πŸ—οΈ Architecture

PFA (Practical Flutter Architecture)

This app follows Thomas Burkhart's pragmatic three-layer architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Views Layer (UI)           β”‚
β”‚  - WatchingWidgets with watch_it    β”‚
β”‚  - Self-responsible pages           β”‚
β”‚  - Reactive state updates           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  ↕
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       Managers Layer (Logic)        β”‚
β”‚  - Business logic with Commands     β”‚
β”‚  - ValueNotifiers for state         β”‚
β”‚  - Validation & coordination        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  ↕
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Services Layer (I/O)           β”‚
β”‚  - Hive local storage               β”‚
β”‚  - Firebase (Phase 2)               β”‚
β”‚  - Pure data transformation         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Technologies

  • State Management: watch_it v1.7.0 - Reactive widgets without boilerplate
  • Command Pattern: command_it v8.0.0 - Wraps operations with execution state
  • Dependency Injection: get_it v8.0.0 - Service locator pattern
  • Local Storage: hive v2.2.3 - Fast NoSQL database
  • ID Generation: uuid v4.0.0 - Unique identifiers

πŸš€ Getting Started

Prerequisites

  • Flutter SDK 3.9.0 or higher
  • Dart 3.0+ (included with Flutter)

Installation

  1. Clone the repository

    cd todoit
  2. Install dependencies

    flutter pub get
  3. Generate code

    dart run build_runner build --delete-conflicting-outputs
  4. Run the app

    # Chrome (recommended for development)
    flutter run -d chrome
    
    # iOS Simulator
    flutter run -d ios
    
    # Android Emulator
    flutter run -d android

Running Tests

# Run all tests
flutter test

# Run with coverage
flutter test --coverage

# Run specific test file
flutter test test/models/todo_test.dart

Test Results: βœ… 69/69 passing (~98% coverage)


πŸ“ Project Structure

lib/
β”œβ”€β”€ main.dart                          # App entry point with Hive initialization
β”œβ”€β”€ locator.dart                       # Dependency injection setup
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ todos/
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   β”œβ”€β”€ todo.dart             # Domain model
β”‚   β”‚   β”‚   β”œβ”€β”€ todo_dto.dart         # Hive DTO
β”‚   β”‚   β”‚   └── todo_dto.g.dart       # Generated Hive adapter
β”‚   β”‚   β”œβ”€β”€ managers/
β”‚   β”‚   β”‚   └── todo_manager.dart     # Business logic with Commands
β”‚   β”‚   └── views/                    # [Phase 1B - TODO]
β”‚   β”‚       β”œβ”€β”€ todo_list_view.dart
β”‚   β”‚       └── todo_form_view.dart
β”‚   └── settings/
β”‚       β”œβ”€β”€ managers/                 # [Phase 1B - TODO]
β”‚       └── views/                    # [Phase 1B - TODO]
β”œβ”€β”€ services/
β”‚   └── storage/
β”‚       └── hive_storage_service.dart # Local storage implementation
└── shared/
    β”œβ”€β”€ widgets/                      # [Phase 1B - TODO]
    └── utils/                        # [Phase 1B - TODO]

test/
β”œβ”€β”€ models/
β”‚   └── todo_test.dart                # 17 tests βœ…
β”œβ”€β”€ services/
β”‚   └── hive_storage_service_test.dart # 24 tests βœ…
└── managers/
    └── todo_manager_test.dart        # 28 tests βœ…

✨ Features

Implemented (Phase 1A)

  • βœ… Todo CRUD operations (Create, Read, Update, Delete)
  • βœ… Toggle todo completion status
  • βœ… Filter todos (All / Active / Completed)
  • βœ… Clear completed todos
  • βœ… Persistent local storage with Hive
  • βœ… Automatic sorting (newest first)
  • βœ… Input validation (title required)
  • βœ… UUID generation for unique IDs
  • βœ… Timestamp tracking (created/updated)
  • βœ… Reactive state management
  • βœ… Command pattern for operations

Planned (Phase 1B - UI)

  • ⏳ Todo list view with filters
  • ⏳ Add/Edit todo form
  • ⏳ Swipe to delete
  • ⏳ Dark mode support
  • ⏳ Settings screen
  • ⏳ Empty states
  • ⏳ Loading indicators
  • ⏳ Error handling UI

Planned (Phase 2 - Cloud)

  • ⏳ Firebase authentication
  • ⏳ Cloud Firestore sync
  • ⏳ Offline-first architecture
  • ⏳ Conflict resolution
  • ⏳ Multi-device sync

πŸ§ͺ Testing

Test Coverage

Component Tests Coverage Status
Todo Model 17 100% βœ…
HiveStorageService 24 100% βœ…
TodoManager 28 ~95% βœ…
Total 69 ~98% βœ…

What's Tested

  • βœ… Data model conversions (Todo ↔ DTO)
  • βœ… All CRUD operations
  • βœ… Business logic (add, update, delete, toggle, filter)
  • βœ… Computed properties (counts, checks)
  • βœ… Edge cases (empty data, null values, large datasets)
  • βœ… Error scenarios (validation, not found)

See TEST_SUMMARY.md for detailed coverage report.


🎯 Code Quality

Static Analysis

flutter analyze

Result: βœ… No issues found!

Code Generation

Hive adapters are generated using build_runner:

# Generate once
dart run build_runner build

# Watch for changes
dart run build_runner watch

# Delete conflicting outputs
dart run build_runner build --delete-conflicting-outputs

πŸ”§ Development Workflow

Adding a New Feature

  1. Update Domain Model (lib/features/todos/models/)
  2. Update DTO (if storage schema changes)
  3. Run Code Generation (dart run build_runner build)
  4. Update Service Layer (if I/O operations needed)
  5. Update Manager (business logic and commands)
  6. Write Tests (aim for >90% coverage)
  7. Update Views (UI implementation)
  8. Run Tests (flutter test)
  9. Run Analyzer (flutter analyze)

Best Practices

  • βœ… Always prefer editing existing files over creating new ones
  • βœ… Follow PFA layer separation (Views β†’ Managers β†’ Services)
  • βœ… Use Commands for state-modifying operations
  • βœ… Use watch_it for reactive UI updates
  • βœ… Write tests before implementation (TDD encouraged)
  • βœ… Keep ValueNotifiers in Managers, not Views
  • βœ… Validate in Manager layer, not Views
  • βœ… Never modify state directly, always through Commands

See rules.md for complete architecture guidelines.


πŸ“– Learning Resources

PFA Architecture

Dependencies Documentation


πŸ› οΈ Troubleshooting

Common Issues

Problem: Tests failing with "ValueNotifier used after disposal" Solution: Ensure proper async handling in setUp/tearDown with delays

Problem: Build runner fails Solution: Run with --delete-conflicting-outputs flag

Problem: Hive adapter not found Solution: Run dart run build_runner build and restart app

Problem: Import errors for generated files Solution: Run flutter pub get then dart run build_runner build


🀝 Contributing

This is a learning project following PFA architecture principles. Key areas for contribution:

  1. Phase 1B: Implement UI layer with WatchingWidget
  2. Phase 2: Add Firebase integration
  3. Testing: Add widget and integration tests
  4. Documentation: Improve code comments and examples

πŸ“ License

This project is created for educational purposes to demonstrate PFA architecture.


πŸ™ Acknowledgments

  • Thomas Burkhart for the PFA architecture and watch_it/command_it packages
  • Flutter Team for the amazing framework
  • Hive developers for the fast local database

πŸ“Š Project Stats

  • Lines of Code: ~800 (excluding tests and generated files)
  • Test Lines: ~1,100
  • Test Coverage: ~98%
  • Build Time: ~30s (web)
  • Test Time: ~12s
  • Dependencies: 8 main, 5 dev

🚦 Next Steps

  1. Implement Todo List View (Phase 1B - Step 8)
  2. Implement Todo Form (Phase 1B - Step 9)
  3. Add Navigation (Phase 1B - Step 10)
  4. Create Shared Widgets (Phase 1B - Step 11)
  5. Add Widget Tests (Phase 1B - Steps 13-14)

See plan.md for the complete roadmap.


Built with ❀️ using Flutter and PFA Architecture

For questions or issues, refer to the documentation files in this repository.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Dart 60.9%
  • C++ 18.6%
  • CMake 14.8%
  • Ruby 2.1%
  • Swift 1.5%
  • C 1.1%
  • Other 1.0%