This is a fundamentals Flutter project that builds a simple frontend for the companion FastAPI project at /Users/mike/Projects/fastAPI-101.
- Flutter app: iPhone Simulator + macOS desktop targets
- Mock vs Live API: toggle in-app to develop UI without the backend running
- Example feature: Items list + detail + create + delete
- Delete requires an API key header (
x-api-key)
- Delete requires an API key header (
- Flutter SDK installed (
flutter doctoris clean) - FastAPI backend available locally (see below)
The app uses flutter_dotenv for configuration.
- Copy
.env.exampleto.env:cp .env.example .env
- Edit
.envto match your local setup (e.g., changeBASE_URLfor Android emulators).
Note: .env is excluded from source control to prevent leaking sensitive information.
From the backend repo:
cd /Users/mike/Projects/fastAPI-101
uvicorn main:app --reload --port 8000The API should be available at http://localhost:8000.
List devices:
flutter devicesTo run on Android you need the Android SDK installed (via Android Studio). If flutter doctor says it can’t find the SDK, install Android Studio and then install:
- Android SDK Platform
- Android SDK Build-Tools
- Android Emulator
Then create and start an emulator:
flutter emulators
flutter emulators --launch <emulator-id>Run the app:
flutter run -d <emulator-id>Important: on the Android emulator, your Mac’s localhost is 10.0.2.2.
So if your FastAPI is running on http://localhost:8000 on your Mac, set the Flutter base URL to:
http://10.0.2.2:8000
Run on iPhone 13 Simulator:
flutter run -d "iPhone 13"Run on macOS desktop:
flutter run -d macosOpen Settings (top-right):
- Use mock data: ON uses local fake data, OFF calls FastAPI
- Base URL:
http://localhost:8000 - API Key: default dev key is
dev-key-123(sent asx-api-key)
flutter testRun on iPhone Simulator:
flutter test integration_test -d "iPhone 13"Run on Android emulator (replace with your emulator id from flutter devices):
flutter test integration_test -d <emulator-id>