πŸ›’ Bringo

Customer App

API URL & Maps Key

Two things connect the app to your services: the API base URL (your backend) and a Google Maps key (for the map UI).

1. API base URL

Open lib/config/env.dart and set the URLs to your backend. prod is what release builds use:

static const String _apiBaseDevAndroid = 'http://10.0.2.2:8000/api';
static const String _apiBaseDevIos     = 'http://localhost:8000/api';
static const String _apiBaseStaging    = 'https://staging.YOUR_DOMAIN.com/api';
static const String _apiBaseProd       = 'https://YOUR_DOMAIN.com/api';   // ← your live API

The app keeps the /api suffix and adds the customer prefix automatically (e.g. /api/v1_6/customer/…). Choose the environment at build time:

flutter run --dart-define=APP_ENV=dev      # local testing
flutter build apk --dart-define=APP_ENV=prod   # release
πŸ“‘
Testing on a physical phone? 10.0.2.2 only works on the Android emulator. On a real device, set the dev URL to your computer's LAN IP (e.g. http://192.168.1.5:8000/api) and keep the phone on the same Wi-Fi.

2. Google Maps key

The app shows native maps (store/address picker) and a static map (order tracking). First create & restrict your keys β€” see Google Maps.

Android native map

Paste your key directly into android/app/src/main/AndroidManifest.xml (inside <application>). No build flag is needed:

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="YOUR_ANDROID_MAPS_KEY"/>

Then just build normally: flutter build appbundle --release --dart-define=APP_ENV=prod.

The app ships with the YOUR_ANDROID_MAPS_KEY placeholder β€” maps stay blank until you paste your own key. If you ever want to inject the key at build time instead, replace the value with ${MAPS_API_KEY} and pass -PMAPS_API_KEY=YOUR_KEY.

iOS native map

Paste your iOS Maps key in ios/Runner/AppDelegate.swift:

import GoogleMaps
// inside application(_:didFinishLaunchingWithOptions:)
GMSServices.provideAPIKey("YOUR_IOS_MAPS_KEY")

Order-tracking static map

This one is admin-managed: set Google Maps API Key in Admin β†’ Settings β†’ Google API and the app uses it automatically. No build flag needed. (A build-time --dart-define=MAPS_API_KEY=… is only a fallback.)

πŸ—ΊοΈ
That admin key's Google Cloud project must have Maps Static API enabled β€” it's a separate toggle from the JavaScript/native SDK APIs. If it's off, the tracking screen shows β€œMap preview unavailable” while every other map in the app works. See Google Maps β†’ Troubleshooting.
πŸ”’
Restrict each Maps key (Android β†’ package + SHA-1, iOS β†’ bundle id) in Google Cloud, and enable billing, or the map shows an error. See Google Maps.
πŸ‘‰
Next: Firebase & Login.