Prompt file imported from isyll/flutter-grpc-starter (
.github/prompts/new-feature.prompt.md). Copyright stays with the author.
Scaffold a new feature named by me (snake_case) following the Flutter gRPC Starter architecture.
- Create
lib/features/<feature>/with:data/<feature>_api.dart: abstract interface plus a gRPC implementation takingGrpcClient(callclient.<service>.<method>()throughclient.call/client.run), and a fake implementation if the backend is not ready.domain/: plainEquatableentities with hand-writtenfromJson/toJson, and<feature>_repository.dartwhose methods returnResult<T>.presentation/bloc/orpresentation/cubit/: aBlocfor event-driven or long-lived flows, aCubitfor simple screen state, withEquatablestates in apartfile.presentation/pages/<feature>_page.dartproviding its bloc viaBlocProvider, andpresentation/widgets/for page-specific widgets.
- Register the data source and repository in
lib/core/di/injector.dartas lazy singletons. - Add the route in
lib/app/router/app_routes.dartandlib/app/router/app_router.dart. Add the path toAppRoutes.publicPathsonly if it must be reachable while signed out. - Add user-facing strings to
assets/l10n/app_en.arbandassets/l10n/app_fr.arb, runflutter gen-l10n, and usecontext.l10nin widgets. - Map errors with
mapGrpcErrorand surface them withlocalizedMessage. Use adaptive widgets fromlib/shared/widgets/where a platform-specific look matters. - Verify with
dart format libandflutter analyze --no-pub(zero issues required).
Respect AGENTS.md conventions: no code comments, no em dashes, simple commit messages.
