This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
flutter pub get # Install dependencies
flutter run # Run on connected device
flutter run -d chrome # Run on web
flutter test # Run all tests
flutter test test/models/user_test.dart # Run a single test file
flutter analyze # Run linter (uses flutter_lints)
flutter build apk # Build Android APK
flutter build web # Build for web
flutter clean # Clean build artifacts
dart run build_runner build # Code generation (json_serializable)This project uses a Unified API Architecture built on Riverpod 3 + Dio + fpdart (Either pattern). The core idea: 2 files per API feature (a model + a provider registration) instead of 12+ files in traditional Clean Architecture.
api/api_service.dart—ApiServiceFactoryprovidescreateReadOnlyandcreateCRUDfactory methods that returnApiService<T>instances from anApiConfig<T>. Provides full CRUD (GET list, GET single, POST, PUT, DELETE).state/base_state.dart— Generic state classes:DataListState<T>andDataItemState<T>with loading/error/success transitions.DataListNotifier<T>is an abstractNotifierbase class for list operations.data/base_repository.dart— Generic HTTP operations returningEither<Failure, T>via fpdart.network/api_client.dart— Dio HTTP client configuration. Base URL: JSONPlaceholder (https://jsonplaceholder.typicode.com).providers/api_providers.dart— Centralized provider registry with concreteNotifiersubclasses (UsersNotifier,PostsNotifier),NotifierProviderregistrations,FutureProvider.familyfor by-ID lookups, and extension methods onWidgetRef(e.g.,ref.usersState,ref.usersNotifier).errors/failures.dart— Error type definitions.baseui/error_api.dart— ReusableErrorApiWidgetfor consistent error display with retry.
- Create a model in
lib/models/with@JsonSerializable()annotation andpartdirective for generated code - Run
dart run build_runner buildto generate the.g.dartfile - Create a concrete
Notifiersubclass extendingDataListNotifier<T>inlib/core/providers/api_providers.dart, overriding theconfiggetter with yourApiConfig<T> - Register a
NotifierProviderand add extension methods onWidgetRef
- Pages extend
ConsumerWidget(Riverpod) and live inlib/pages/ - State is accessed via
ref.watch()on providers fromApiProviders - Error handling flows through
Either<Failure, T>from fpdart - Models use
@JsonSerializable()with code generation (.g.dartfiles) - App entry (
lib/main.dart) wraps the app inProviderScopewith Material 3 theming
Tests are in test/ mirroring the lib/ structure. Uses flutter_test and mockito. Tests cover model serialization, state transitions, provider definitions, widget rendering, and navigation. No integration tests or network mocking — tests focus on unit and widget levels.
- Flutter SDK
^3.8.0, Dart SDK^3.8.0 - Template project using JSONPlaceholder as a demo API
- Multi-platform: Android, iOS, Web
- Main branch:
develop