feat(flutter): add API client and Reminder model - #406
Conversation
Reminder model with JSON mapping (date-only UTC limitDate, accepts Z and offset inputs) and RemindersApi REST client over the http package against the nginx endpoint: list, get, create, update, delete, toggle. ApiException carries status, message and per-field validation errors from the .NET problem-details shape and the Go and C++ message shape. Base URL via --dart-define=API_BASE_URL, default reaches the host from the Android emulator. Unit tests cover the model and every client call. Closes #337
202f954 to
0b75c81
Compare
|
Reviewed diff. No prior review comments found. [minor]
Contract check: verified No em/en dashes, PR title conventional, no AI attribution, no schema changes (no migrations needed), tests cover model + client thoroughly. Ready for human review. |
…-0009 Review findings: a malformed 2xx body threw a raw FormatException; it now becomes an ApiException like every other failure. ADR-0009 records the choice of package:http for the client.
|
Addressed in 547378f: success-path jsonDecode now maps malformed bodies to ApiException (test added), ADR-0009 records the http package choice. |
|
Re-reviewed full diff (both commits). Prior findings addressed: success-path [minor]
No blockers or majors. Contract shapes, error mapping, tests, ADR, no dashes, conventional title, no AI attribution all check out. Ready for human review. |
Summary
lib/api/reminder.dart:Remindermodel (id, title, description, limitDate, isDone),fromJson/toJsonwith date-only UTClimitDate(yyyy-MM-ddT00:00:00Z, acceptsZand+00:00inputs),copyWith, value equality.lib/api/api_client.dart:RemindersApiover thehttppackage (new dependencyhttp ^1.2.0, the standard Flutter HTTP client, testable withMockClient):fetchAll,fetchOne,create,update,delete,toggleDone.ApiExceptionwith status code, message and per-field errors, mapping the .NET problem-detailserrorsmap and the Go/C++{message}shape;isNotFound,isValidation,isNetwork.--dart-define=API_BASE_URL, defaulthttp://10.0.2.2:9999(Android emulator to host nginx).Parent: #325. Next: #338 list screen consumes this client.
Closes #337
Test plan
flutter analyzeclean,flutter test23/23,dart formatapplied--dart-define=API_BASE_URL=http://localhost:9999, temporary test not committed): create, list, fetch, toggle, delete, 404 after delete, across the load-balanced .NET/Go/C++ APIsBuild and Test Flutter Appgreen