`--delete-conflicting-outputs` was removed in build_runner 2.15 and is now ignored with a warning; conflicting outputs are handled automatically. Documenting it kept sending agents down a no-op path. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2.9 KiB
2.9 KiB
AGENTS.md
Flutter mobile app for browsing Twitch on iOS and Android. Uses MobX for state management with code generation.
Commands
flutter pub get # Install dependencies
flutter run --dart-define=CLIENT_ID=ID --dart-define=SECRET=SECRET # Run with Twitch credentials
flutter analyze # Static analysis
flutter test # Run tests
dart run build_runner build # Regenerate .g.dart files (MobX/JSON models)
--delete-conflicting-outputs was removed in build_runner 2.15 and is now ignored — conflicting outputs are handled automatically.
Source Structure
lib/apis/— API services (all extendBaseApiClient)lib/models/— Data models (@JsonSerializablewith.g.dartcodegen)lib/screens/{feature}/— Feature screens with co-locatedstores/subdirectorieslib/stores/— Global stores only (e.g.,global_assets_store.dart)lib/services/— App-level serviceslib/widgets/— Shared widgetslib/utils/— Utility functions
Architecture
- Feature stores live in
lib/screens/{feature}/stores/— don't create new top-level store files (onlylib/stores/holds global stores) - All API services extend
BaseApiClient(lib/apis/base_api_client.dart) — don't create standalone API classes - MobX stores use a generated mixin pattern — see
lib/screens/settings/stores/auth_store.dartfor the canonical example
Code Opinions
- Extract related/grouped logic (state, reactions, actions) into dedicated stores when it improves readability — keep widgets focused on rendering
- Default to writing tests: new or changed logic (stores, API clients, parsing, utils) ships with tests; when touching existing tested code, update or extend its tests. Pure UI/rendering or config changes may skip.
Gotchas
- After changing MobX stores or
@JsonSerializablemodels, regenerate withdart run build_runner build. Never edit.g.dartfiles directly. Commit.g.dartfiles to source control. - The secure storage cleanup in
main.dartlooks unnecessary but handles an Android/iOS edge case where secure storage persists after uninstall. Don't remove it. - Several deps in
pubspec.yamlare git-pinned forks carrying compatibility patches (extended_text_field,better_native_video_player,simple_pip_mode). When upgrading dependencies, don't swap them back to pub.dev releases.
Testing
flutter testruns all tests;flutter test test/path/to/file.dartfor a single file- HTTP mocking:
http_mock_adapter(DioAdapter) — use full URLs inonGet/onPost - General mocking:
mocktail(no codegen required) - Test layout mirrors
lib/(test/apis/,test/models/,test/screens/); shared fixtures live intest/fixtures/(e.g.,irc_messages.dart,api_responses.dart)