Delivery App
API URL & Maps Key
1. API base URL
Open lib/config/env.dart and set your backend URL:
static const String apiBase = String.fromEnvironment(
'API_BASE',
defaultValue: 'https://YOUR_DOMAIN.com', // β your live API
);
static const String apiPrefix = '/api/v1/partner';
You can also override it at build time without editing the file:
flutter build apk --release --dart-define=API_BASE=https://your-domain.com
A value passed with --dart-define always wins over the defaultValue in the file, so you can keep one source file and build for several environments.
Local development
http://10.0.2.2:8000 β the emulator's alias for your computer's localhost.http://localhost:8000 β the simulator shares the Mac's network stack.http://192.168.1.5:8000, phone on the same Wi-Fi. Rider testing almost always needs a real device (GPS), so this is the usual case.Start the backend with php artisan serve --host=0.0.0.0 so it accepts connections from the phone. Your production URL must be https:// with a valid certificate β Android 9+ and iOS block plain http:// outside the debug build.
This app normalises a trailing slash on apiBase, so https://your-domain.com/ and https://your-domain.com both work here.
2. Google Maps key
The Delivery app uses maps for the rider's live location and navigation. Paste your key directly into android/app/src/main/AndroidManifest.xml (inside <application>) β no build flag needed:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_ANDROID_MAPS_KEY"/>
For iOS, paste your Maps key in ios/Runner/AppDelegate.swift via GMSServices.provideAPIKey("YOUR_IOS_MAPS_KEY").
3. Live-route / tracking map (admin key)
The live-route screen draws a static map image using the admin-managed key (Admin β Settings β Google API β Google Maps API Key), not the build-time key above.
If you would rather not depend on the admin setting during development, lib/config/env.dart also accepts a build-time fallback:
flutter run --dart-define=MAPS_STATIC_KEY=YOUR_STATIC_MAPS_KEY
The admin-panel value takes priority; this flag only fills in when the admin key is empty.
4. Location permissions
Rider tracking needs location access while the app is in the background β a delivery runs with the screen off. The permission strings ship configured, but you must justify them when you publish:
ACCESS_FINE_LOCATION plus ACCESS_BACKGROUND_LOCATION in AndroidManifest.xml. Google Play requires a short background location declaration and a demo video showing why the app needs it β budget time for this review.NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in ios/Runner/Info.plist. Edit the wording to name your brand; App Review rejects vague strings.5. Verify the connection
- Run the app and sign in with a delivery partner account created in your admin panel (Admin → Delivery Partners).
- Go online with the duty toggle β the dashboard should show your own zones and pending orders.
- Check the backend log
storage/logs/laravel.logfor the incoming requests.