Flutter frontend for Spring Petclinic. This app targets Android and web, mirrors the functional flows of the Angular frontend, and uses the same REST backend exposed by spring-petclinic-rest.
The CI status includes static analysis, tests, the web build, and the Android debug APK build.
- Screenshots
- Project Structure
- Backend
- API Configuration
- Run on Android
- Run on Web
- Build
- Validation
- Contributing
The codebase follows a feature-first package structure under the lib directory:
lib/
├── features/ # Feature-specific modules (screens, services, models)
│ ├── home/ # Home screen
│ ├── owners/ # Owner management (list, details, form)
│ ├── pets/ # Pet management (form)
│ ├── pettypes/ # Pet type administration
│ ├── specialties/ # Vet specialties administration
│ ├── vets/ # Veterinarians list and forms
│ └── visits/ # Pet visit registration and history
├── shared/ # Common and shared components across features
│ ├── config/ # Global configuration (e.g., API config)
│ ├── forms/ # Generic form validators and text helpers
│ ├── navigation/ # App routes and navigation extensions
│ ├── network/ # HTTP/REST API client and exception handling
│ ├── theme/ # App color schemes and typography
│ ├── utils/ # Helper functions and formatting utilities
│ └── widgets/ # Reusable layout and UI widgets
└── main.dart # App entry point
Start the backend first:
cd ~/spring-petclinic-rest
./mvnw spring-boot:runThe expected API is:
http://localhost:9966/petclinic/api
The app resolves the API base URL in this order:
PETCLINIC_API_BASE_URLpassed with--dart-define- Platform default
Platform defaults:
- Android emulator:
http://10.0.2.2:9966/petclinic/api - Web:
http://localhost:9966/petclinic/api - Other non-Android platforms:
http://localhost:9966/petclinic/api
That logic lives in:
lib/shared/config/api_config.dart
Override it at runtime when needed:
flutter run --dart-define=PETCLINIC_API_BASE_URL=http://<host>:9966/petclinic/apiUse an explicit override when:
- running on a physical Android device;
- serving the web app against a backend that is not on
localhost; - pointing the app to a shared/staging backend.
For an Android emulator:
cd ~/spring-petclinic-flutter
flutter pub get
flutter runFor a physical Android device, pass the host machine IP explicitly:
flutter run --dart-define=PETCLINIC_API_BASE_URL=http://<host>:9966/petclinic/apiFor local browser development against the backend running on the same machine:
cd ~/spring-petclinic-flutter
flutter pub get
flutter run -d chromeIf the backend is not reachable at http://localhost:9966/petclinic/api, pass an override:
flutter run -d chrome --dart-define=PETCLINIC_API_BASE_URL=http://<host>:9966/petclinic/apiBuild an Android debug APK:
flutter build apk --debugBuild the web app:
flutter build webTypical checks:
dart format --set-exit-if-changed .
flutter analyze
flutter test
flutter build apk --debug
flutter build webGitHub Actions also runs dependency vulnerability scanning with OSV Scanner, an advisory Semgrep scan, and CodeQL analysis for workflow security.
The issue tracker is the preferred channel for reporting bugs and proposing new features.
Please refer to CONTRIBUTING.md for detailed contribution guidelines, including the pull request process and contribution workflow.



