| .. | ||
| android | ||
| assets | ||
| ios | ||
| lib | ||
| linux | ||
| macos | ||
| test | ||
| web | ||
| windows | ||
| .gitignore | ||
| analysis_options.yaml | ||
| l10n.yaml | ||
| pubspec.yaml | ||
| README.md | ||
mosenioring
Flutter app scaffolded with clean architecture layers, Riverpod state management, and a login flow ready to integrate with a Swagger/OpenAPI backend.
Architecture
lib/src/app: app shell + router (GoRouter)lib/src/di: dependency providerslib/src/core: config, networking, and core utilitieslib/src/features/auth: auth domain/data/presentationlib/src/features/home: home screenlib/src/features/telemetry: telemetry domain/data/presentationlib/l10n: localization (arb files)
Configuration
Runtime configuration is provided via --dart-define values.
Auth + environment flags:
API_BASE_URL(required)USE_LOCAL_AUTH(true/false, default:false)LOCAL_TENANT_ID(default:11111111-1111-1111-1111-111111111111)LOCAL_ROLES(default:CAREGIVER)KEYCLOAK_ISSUER_URIorKEYCLOAK_ISSUER(required whenUSE_LOCAL_AUTH=false)KEYCLOAK_CLIENT_ID(required whenUSE_LOCAL_AUTH=false)KEYCLOAK_REDIRECT_URL(required whenUSE_LOCAL_AUTH=false)
Local dev behavior:
- When
USE_LOCAL_AUTH=true, the app keeps the email/password fields and sendsX-Local-Email,X-Local-Roles, andX-Tenant-Idheaders to the backend. - The backend must run with
SPRING_PROFILES_ACTIVE=localandALLOW_LOCAL_AUTH=true. - Keycloak login via
flutter_appauthis supported only on Android/iOS.
Keycloak redirect URI to register:
com.mosenioring.app://oauth2redirect(Android + iOS)
Swagger/OpenAPI integration
When the spec is ready, generate a client and replace ApiClient usage:
- Save your spec (e.g.,
openapi.yaml) or point to its URL. - Generate a Dart client (OpenAPI Generator or Swagger Codegen).
- Swap
AuthRemoteDataSourceorTelemetryRemoteDataSourceto call the generated client.
Clean and test
flutter clean
flutter test
Clean and build
flutter clean
flutter build apk
Running
flutter pub get
flutter run
Local run
flutter run \
--dart-define=API_BASE_URL=http://10.0.2.2:8080 \
--dart-define=USE_LOCAL_AUTH=true
Android emulator note:
- Use
10.0.2.2instead oflocalhostforAPI_BASE_URLandKEYCLOAK_ISSUER_URI. http://Keycloak issuers are allowed for local dev; the app enables insecure connections automatically for non-HTTPS issuers.- iOS dev builds allow HTTP via App Transport Security; tighten this for production.
Quick start (Keycloak mode):
flutter run -d emulator-5554 \
--dart-define=API_BASE_URL=http://10.0.2.2:8080 \
--dart-define=KEYCLOAK_ISSUER_URI=http://10.0.2.2:8081/realms/mosenioring \
--dart-define=KEYCLOAK_CLIENT_ID=mosenioring-mobile \
--dart-define=KEYCLOAK_REDIRECT_URL=com.mosenioring.app://oauth2redirect
Quick start (local auth, no Keycloak):
export SPRING_PROFILES_ACTIVE=local
export ALLOW_LOCAL_AUTH=true
flutter run -d <device_id> \
--dart-define=API_BASE_URL=http://10.0.2.2:8080 \
--dart-define=USE_LOCAL_AUTH=true \
--dart-define=LOCAL_TENANT_ID=11111111-1111-1111-1111-111111111111 \
--dart-define=LOCAL_ROLES=CAREGIVER
Redirect configuration:
- Android:
android/app/build.gradle.ktssetsappAuthRedirectScheme/appAuthRedirectHostfor AppAuth, andandroid/app/src/main/AndroidManifest.xmlregisters theRedirectUriReceiverActivity. - iOS:
ios/Runner/Info.plistregisterscom.mosenioring.appunderCFBundleURLTypes. - Localization:
l10n.yamlandlib/l10n/*.arbfiles.
Launcher icons:
dart run flutter_launcher_icons