Flutter frontend¶
The frontend is a Flutter Material 3 application organized by feature. It uses Riverpod for dependency injection and state, Dio for HTTP, GoRouter for routes, and flutter_secure_storage for the internal eAkto session reference.
Startup¶
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const ProviderScope(child: EAktoApp()));
}
EAktoApp configures the Lexend-based light theme and MaterialApp.router.
Layers¶
presentation widgets
↓ watch / invoke
Riverpod providers + ApplicationController
↓ call
EAktoRepository
↓ call
ApiClient (Dio)
↓
FastAPI /api/v1
Presentation¶
Feature screens live under frontend/lib/features/<feature>/presentation/. Shared eAkto cards, buttons, navigation, page shells, and error states live in frontend/lib/core/widgets/lifegraph_widgets.dart.
The Home shell uses:
- an
IndexedStackto preserve Home, Updates, and Profile state; - a
DraggableScrollableSheetfor the journey conversation; - a separate custom navigation container and Journey control; and
- backend-backed “My journeys” cards.
State¶
ApplicationController is a StateNotifier<AppState>. It coordinates authentication, intent assessment, active journey state, milestone completion, evidence refresh, and sign-out.
final applicationControllerProvider =
StateNotifierProvider<ApplicationController, AppState>((ref) {
return ApplicationController(
ref.watch(lifeGraphRepositoryProvider),
ref.watch(sessionStorageProvider),
);
});
FutureProviders load independent collections such as journeys and government documents.
Repository and HTTP¶
Widgets never call Dio directly. EAktoRepository declares endpoint operations and ApiClient:
- selects the configured base URL;
- adds
Authorization: Bearer <session>when available; - maps backend error envelopes into
AppError; - uses a 10-second connection timeout and 75-second receive timeout; and
- supports JSON and multipart uploads.
Navigation¶
GoRouter paths are declared centrally in frontend/lib/app/router.dart. Authenticated pages use _AuthenticatedRoute, which shows the government authentication choices when no profile is loaded.
Important routes:
| Route | Purpose |
|---|---|
/auth |
Choose eVerify or eGovPH |
/egovph/sso |
Handle an SSO exchange-code callback |
/home |
Home, Updates, Profile, and journey chat shell |
/documents |
Government document vault |
/journeys |
Full journey collection |
/intent/processing |
AI processing and understanding flow |
/journey/plan |
Dynamic questions and documents |
/journey/document |
Upload one required document |
Local secure storage¶
SessionStorage uses two keys:
lifegraph_session_tokenlifegraph_active_case_id
No provider access token, partner secret, citizen demographic payload, QR value, or document bytes should be stored there.
Legacy demo paths¶
EAktoRepository still contains methods for older /cases, payment, notification, translation, and developer-scenario endpoints. These are used by legacy demo screens and tests but are not mounted by the current FastAPI application. New production-facing code should use the mounted /auth, /intents, /journeys, /identity, and /documents APIs.