Skip to content

feat(flutter): add API client and Reminder model - #406

Merged
kauereinbold merged 2 commits into
mainfrom
feat/flutter-api-client
Aug 22, 2026
Merged

feat(flutter): add API client and Reminder model#406
kauereinbold merged 2 commits into
mainfrom
feat/flutter-api-client

Conversation

@kauereinbold

Copy link
Copy Markdown
Owner

Summary

  • lib/api/reminder.dart: Reminder model (id, title, description, limitDate, isDone), fromJson/toJson with date-only UTC limitDate (yyyy-MM-ddT00:00:00Z, accepts Z and +00:00 inputs), copyWith, value equality.
  • lib/api/api_client.dart: RemindersApi over the http package (new dependency http ^1.2.0, the standard Flutter HTTP client, testable with MockClient): fetchAll, fetchOne, create, update, delete, toggleDone. ApiException with status code, message and per-field errors, mapping the .NET problem-details errors map and the Go/C++ {message} shape; isNotFound, isValidation, isNetwork.
  • Base URL from --dart-define=API_BASE_URL, default http://10.0.2.2:9999 (Android emulator to host nginx).
  • Tests: 7 model cases and 15 client cases (request method, URL, headers, body, error mapping, network failure, trailing-slash base URL). README structure section updated.

Parent: #325. Next: #338 list screen consumes this client.

Closes #337

Test plan

  • flutter analyze clean, flutter test 23/23, dart format applied
  • Live round trip against the local stack (--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++ APIs
  • CI Build and Test Flutter App green

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
@kauereinbold
kauereinbold force-pushed the feat/flutter-api-client branch from 202f954 to 0b75c81 Compare August 22, 2026 12:30
@github-actions

Copy link
Copy Markdown

Reviewed diff. No prior review comments found.

[minor]

  • src/app/flutter/reminders_app/pubspec.yaml:14: new http dep, no ADR. CLAUDE.md says new dependency needs ADR. Add one or note why skipped (standard Flutter HTTP pkg, testable via MockClient).
  • src/app/flutter/reminders_app/lib/api/api_client.dart:123: success path jsonDecode uncaught. Malformed 200 body throws raw FormatException, not ApiException. Wrap in try/catch like _errorFrom does.

Contract check: verified id/title/description/limitDate/isDone shape and error shape (.NET problem-details errors map, Go/C++ {message}) match across all three backend APIs, incl. C++ to_char(... 'YYYY-MM-DD"T"HH24:MI:SS"Z"') producing the same Z-suffixed format the Dart parser expects. No cross-API contract bugs found.

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.
@kauereinbold

Copy link
Copy Markdown
Owner Author

Addressed in 547378f: success-path jsonDecode now maps malformed bodies to ApiException (test added), ADR-0009 records the http package choice.

@github-actions

Copy link
Copy Markdown

Re-reviewed full diff (both commits). Prior findings addressed: success-path jsonDecode now wrapped in try/catch (test added), ADR-0009 covers the http dep choice.

[minor]

  • src/app/flutter/reminders_app/pubspec.lock: lock bumps ~10 unrelated transitive deps (leak_tracker, matcher, vector_math, etc.) and raises dart: ">=3.7.0" to ">=3.9.0-0". CI pins Flutter 3.29.0 (.github/workflows/flutter-pull-request.yml:27), which ships Dart 3.7. Lock looks generated with a newer local Flutter/Dart than CI uses. Regenerate the lock with Flutter 3.29.0 so committed lock matches what CI resolves and what was actually tested.

No blockers or majors. Contract shapes, error mapping, tests, ADR, no dashes, conventional title, no AI attribution all check out.

Ready for human review.

@kauereinbold
kauereinbold merged commit 65562dd into main Aug 22, 2026
8 checks passed
@kauereinbold
kauereinbold deleted the feat/flutter-api-client branch August 22, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(flutter): API client and Reminder model

1 participant