Introduction
The DayOneMart Deliveryman App is a dedicated Flutter mobile application for delivery personnel. It enables deliverymen to receive and manage assigned orders, navigate to delivery locations via Google Maps, update order statuses in real-time, communicate with admin via live chat, and manage their account β all from a single app on Android and iOS.
The app connects to the OneMart Admin & Web backend exclusively via the
REST API at /api/v1/delivery-man/*.
Push notifications are delivered through Firebase Cloud Messaging.
Technology Stack
| Layer | Package / Technology | Version |
|---|---|---|
| Framework | Flutter | SDK (stable) |
| Language | Dart | ^3.9.0 |
| State Management | flutter_bloc + BLoC | ^9.1 / ^9.2 |
| Navigation | go_router + go_transitions | ^17.2 / ^0.8 |
| Dependency Injection | get_it + injectable | ^9.2 / ^2.7 |
| Code Generation | freezed + json_serializable | ^3.2 / ^6.13 |
| Networking | http + connectivity_plus | ^1.6 / ^7.1 |
| Firebase | Core, Messaging, Crashlytics, Analytics | ^4.7 / ^16.2 |
| Maps & Location | google_maps_flutter + geolocator + location | ^2.17 / ^14.0 / ^8.0 |
| Permissions | permission_handler | ^12.0 |
| Images | cached_network_image + image_picker | ^3.4 / ^1.2 |
| Video | video_player + chewie | ^2.11 / ^1.13 |
| Notifications | flutter_local_notifications | ^21.0 |
| Localization | flutter_localizations + intl | SDK / ^0.20 |
| Chat | emoji_keyboard_flutter | ^1.7 |
| Error Tracking | firebase_crashlytics + catcher_2 | ^5.2 / ^2.1 |
| Storage | shared_preferences | ^2.5 |
| OTP | otp_autofill | ^4.1 |
| UI Utilities | shimmer_animation, skeletonizer, flutter_svg, animated_digit, sliver_tools, google_fonts | Latest |
Architecture Overview
The deliveryman app follows the same feature-first clean architecture pattern as the customer app:
- Feature modules β each feature is self-contained under
lib/features/<feature>/ - BLoC pattern β UI is decoupled from business logic via Blocs and Cubits
- GetIt / Injectable β dependency injection with code-generated service locator
- Freezed β immutable data classes and sealed union states
- GoRouter β declarative navigation with deep-link support and fade transitions
- Repository pattern β data sources abstracted behind repository interfaces
App Features
Prerequisites
Development Machine Requirements
| Tool | Minimum Version | Notes |
|---|---|---|
| Flutter SDK | 3.x (stable channel) | Run flutter --version to check |
| Dart SDK | ^3.9.0 | Bundled with Flutter |
| Android Studio | Hedgehog (2023.1+) | Required for Android builds |
| Xcode | 15+ | macOS only β required for iOS builds |
| CocoaPods | Latest | macOS only β sudo gem install cocoapods |
| Java JDK | 17 | For Android Gradle builds |
External Services Required
- Firebase Project β push notifications (FCM), analytics, crashlytics
- Google Maps API Key β map display, directions, delivery navigation
- Backend URL β a running OneMart Admin & Web instance with the deliveryman API enabled
Flutter Environment Check
flutter doctor -v
Resolve all errors before proceeding. Warnings for unneeded platforms (e.g. Linux, Windows) can be ignored if you only target Android/iOS.
Project Structure
lib/ βββ main.dart β App entry point + Firebase init βββ firebase_options.dart β Generated by FlutterFire CLI β βββ config/ β βββ route/ β β βββ route_config.dart β GoRouter route definitions β βββ theme/ β App theme (colors, typography) β βββ util/ β βββ app_constants.dart β API base URL + all endpoints β βββ assets.gen.dart β Generated asset references β βββ dimensions.dart β Spacing / size constants β βββ styles.dart β Reusable TextStyles β βββ core/ β βββ data/ β β βββ api/ β Base HTTP client, interceptors β βββ model/ β β βββ response/ β Generic response wrappers β βββ dependency_injection/ β GetIt setup + injectable config β βββ helper/ β Notification helper, extensions, utils β βββ catcher_logs/ β Catcher_2 error reporting config β βββ features/ β Feature-first modules β βββ splash/ β Splash screen + connectivity check β βββ login/ β Auth (login, OTP, forgot password, set password) β βββ home/ β Home screen + dashboard BLoC β βββ dashboard/ β Bottom nav shell + tab management β βββ order/ β Order list, details, delivery location, cancel, result β βββ chat/ β Chat list, conversations, message sending β βββ account/ β Profile, edit profile, change password, delete account β βββ notification/ β Notification list + management β βββ settings/ β Settings screen, language, theme, password setup β βββ contact_us/ β Contact support form β βββ terms_and_condition/ β Terms of service viewer β βββ file_viewer/ β Image/media file viewer β βββ html/ β Generic HTML content renderer β βββ common/ β Shared widgets, theme BLoC β βββ l10n/ β βββ arb/ β ARB localization source files β β βββ app_en.arb β β βββ app_es.arb β β βββ app_ar.arb β β βββ app_hi.arb β β βββ app_bn.arb β βββ gen/ β Generated localization classes β βββ app_localizations.dart β assets/ βββ images/ β PNG / JPG images β βββ svg/ β SVG icons β β βββ flags/ β Country flag SVGs β βββ gif/ β Animated GIFs
Feature Module Structure
Each feature follows the same internal layout:
features/order/
βββ data/
β βββ models/ β Freezed + JSON serializable DTOs
β βββ repositories/ β Repository implementation (API calls)
βββ domain/
β βββ services/ β Domain service / repository interface
βββ presentation/
βββ bloc/ β BLoC / Cubit + States + Events
β βββ order/ β Order list & detail BLoC
β βββ order_delivery_location/ β Map tracking BLoC
βββ screens/ β Full-screen widgets
βββ widgets/ β Reusable widgets for this feature
βββ utils/ β Feature-specific utilities
Navigation Structure
The app uses a ShellRoute for the main dashboard with a bottom navigation bar housing four tabs:
| Tab | Route | Screen |
|---|---|---|
| Home | /home | HomeScreen β dashboard with stats |
| Orders | /order | OrdersScreen β active & completed orders |
| Chat | /chat | ChatScreen β chat with admin |
| Account | /account | AccountScreen β profile & settings |
Quick Start
Setup Checklist
- Flutter SDK installed and
flutter doctorpasses - Android Studio / Xcode configured with emulator/simulator
- Firebase project created with Android + iOS apps registered (package:
com.dayonesoft.onemartdeliveryman) - Google Maps API key obtained and enabled for Maps SDK + Directions API
- Backend (Admin & Web) is deployed and accessible
Install and Run
# 1. Get all pub packages flutter pub get # 2. Generate code (freezed models, injectable DI, asset refs) dart run build_runner build --delete-conflicting-outputs # 3. Generate localization files flutter gen-l10n # 4. Run the app flutter run
Configuration
API Base URL
Open lib/config/util/app_constants.dart and update the baseUrl
to point to your deployed OneMart Admin & Web instance:
// lib/config/util/app_constants.dart
class AppConstants {
static const String baseUrl = 'https://yourdomain.com';
// ...
}
baseUrl points to the demo server.
You MUST change it to your own backend URL before building for production.
Failure to do so will cause the app to send requests to the wrong server.
App Name & Bundle ID
| Platform | File | Key |
|---|---|---|
| Android | android/app/build.gradle |
applicationId (default: com.dayonesoft.onemartdeliveryman) |
| Android | android/app/src/main/AndroidManifest.xml |
android:label |
| iOS | ios/Runner/Info.plist |
CFBundleName, CFBundleIdentifier |
Currency Symbol
The default currency symbol is configured in app_constants.dart:
static String currencySymbol = "ΰ§³"; // Change to your currency static String currencySymbolPosition = 'left'; // 'left' or 'right'
Firebase Setup
-
Create or select your Firebase project Go to the Firebase Console. You can reuse the same Firebase project used for the Admin & Web backend and Customer App.
-
Register Android app Use the package name
com.dayonesoft.onemartdeliveryman. Downloadgoogle-services.jsonand place it at:android/app/google-services.json
-
Register iOS app Use the bundle ID
com.dayonesoft.onemartdeliveryman. DownloadGoogleService-Info.plistand add it to Xcode at:ios/Runner/GoogleService-Info.plist
-
Generate firebase_options.dart
# Install FlutterFire CLI (if not already installed) dart pub global activate flutterfire_cli # Login to Firebase firebase login # Generate firebase_options.dart flutterfire configure
This creates/updateslib/firebase_options.dartautomatically. -
Enable Firebase services In the Firebase Console, enable:
- Cloud Messaging (FCM) β required for push notifications
- Crashlytics β automatic crash reporting
- Analytics β usage analytics
FCM Topics
The app subscribes to the following FCM topics on launch:
deliveryman-group // All deliveryman-specific broadcast messages all-general // Platform-wide announcements
Google Maps Setup
Step 1 β Enable APIs in Google Cloud Console
- Maps SDK for Android
- Maps SDK for iOS
- Directions API (for delivery route navigation)
- Geocoding API
Step 2 β Configure Android (secrets.xml)
Copy the template and fill in your Google Maps API key:
cp secrets.xml.example android/app/src/main/res/values/secrets.xml
<!-- android/app/src/main/res/values/secrets.xml -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="google_maps_api_key">YOUR_GOOGLE_MAPS_API_KEY</string>
</resources>
secrets.xml is gitignored and must never be committed.
Keep your API keys safe and out of version control.
Step 3 β Configure iOS
Add the Google Maps API key to ios/Runner/Info.plist:
<key>GoogleMapsApiKey</key> <string>YOUR_GOOGLE_MAPS_API_KEY</string>
Location Permissions
The app uses geolocator, location, and permission_handler
to request and manage location permissions. On first launch, the user is prompted to grant
location access, which is required for delivery navigation. The required permission entries
are already included in the AndroidManifest.xml and Info.plist.
Localization
The app supports 5 languages out of the box:
| Language | Code | ARB File |
|---|---|---|
| English | en | lib/l10n/arb/app_en.arb |
| Spanish | es | lib/l10n/arb/app_es.arb |
| Arabic | ar | lib/l10n/arb/app_ar.arb |
| Hindi | hi | lib/l10n/arb/app_hi.arb |
| Bangla | bn | lib/l10n/arb/app_bn.arb |
Localization Config
The localization configuration is defined in l10n.yaml:
arb-dir: lib/l10n/arb template-arb-file: app_en.arb output-localization-file: app_localizations.dart output-dir: lib/l10n/gen nullable-getter: false
Adding a New Language
-
Create a new ARB file, e.g.
lib/l10n/arb/app_fr.arb. Copy the structure fromapp_en.arband translate all strings. -
Add the language to the
languageslist inapp_constants.dart:LanguageModel(code: 'fr', name: 'French', nativeName: 'FranΓ§ais'),
-
Regenerate localization files:
flutter gen-l10n
ar) is an RTL language. Flutter handles layout mirroring automatically
when the ar locale is active. Untranslated strings are tracked in
untranslated.txt at the project root.
Build & Release
Android β Signing Setup
-
Create a release keystore:
keytool -genkey -v -keystore android/app/upload-keystore.jks \ -keyalg RSA -keysize 2048 -validity 10000 -alias upload
-
Create
android/key.properties:storePassword=<your-store-password> keyPassword=<your-key-password> keyAlias=upload storeFile=upload-keystore.jks
.jks) and key.properties file safe.
You need them for every future app update on Google Play. Losing the keystore means
you cannot publish updates to the same listing.
Android β Debug APK
flutter build apk --debug # Output: build/app/outputs/flutter-apk/app-debug.apk
Android β Release APK
flutter build apk --release --obfuscate --split-debug-info=build/app/outputs/symbols # Output: build/app/outputs/flutter-apk/app-release.apk
Android β App Bundle (Google Play)
flutter build appbundle --release --obfuscate --split-debug-info=build/app/outputs/symbols # Output: build/app/outputs/bundle/release/app-release.aab
--obfuscate shrinks and obfuscates Dart code for production.
--split-debug-info saves debug symbols needed for deobfuscating
crash reports in Firebase Crashlytics and Google Play Console.
Always keep the symbols directory alongside your release.
iOS β Release (App Store)
flutter build ipa --release --obfuscate --split-debug-info=build/ios/symbols
Then open build/ios/ipa in Xcode Organizer or use Transporter to upload
to App Store Connect.
API Integration
All API endpoints are declared in lib/config/util/app_constants.dart.
The HTTP client in lib/core/data/api/ prepends the baseUrl
and handles JWT token attachment, refresh, and error handling automatically.
Authentication Flow
POST /api/v1/delivery-man/auth/login β Email/phone + password POST /api/v1/delivery-man/auth/send-login-otp β Request login OTP POST /api/v1/delivery-man/auth/verify-login-otp β Verify OTP β returns JWT POST /api/v1/delivery-man/auth/forgot-password β Initiate password reset POST /api/v1/delivery-man/auth/verify-otp β Verify reset OTP POST /api/v1/delivery-man/auth/reset-password β Set new password POST /api/v1/delivery-man/auth/refresh β Refresh JWT token POST /api/v1/delivery-man/auth/logout β Invalidate session
Core Endpoints
| Feature | Method | Endpoint |
|---|---|---|
| App Config | GET | /api/v1/delivery-man/config |
| Dashboard | GET | /api/v1/delivery-man/dashboard |
| Orders | GET/PUT | /api/v1/delivery-man/orders |
| Map Direction | GET | /api/v1/delivery-man/config/map-direction |
| Profile | GET/PUT | /api/v1/delivery-man/profile |
| FCM Token | PUT | /api/v1/delivery-man/profile/fcm-token |
| Change Password | PUT | /api/v1/delivery-man/profile/change-password |
| Delete Account | DELETE | /api/v1/delivery-man/profile/delete-account |
| Settings | GET/PUT | /api/v1/delivery-man/profile/settings |
| Chat | GET/POST | /api/v1/delivery-man/chats |
| Notifications | GET/PUT/DELETE | /api/v1/delivery-man/notifications |
| Terms | GET | /api/v1/delivery-man/config/terms |
| Support / Contact | GET | /api/v1/delivery-man/config/support |
Request Headers
Authorization: Bearer {jwt_token}
Accept: application/json
Content-Type: application/json
X-localization: en β Current language code
Troubleshooting
"google-services.json not found"
Ensure you have downloaded the file from Firebase Console and placed it at:
android/app/google-services.json
"Cannot resolve symbol '@string/google_maps_api_key'"
Create secrets.xml from the template:
cp secrets.xml.example android/app/src/main/res/values/secrets.xml # Then edit secrets.xml and add your real API key
Firebase Initialization Failed
dart pub global activate flutterfire_cli flutterfire configure
Build Runner Conflicts
dart run build_runner clean dart run build_runner build --delete-conflicting-outputs
Gradle Build Failures (Android)
- Run
flutter clean && flutter pub getand try again - Ensure
JAVA_HOMEpoints to JDK 17 - Check that
google-services.jsonis present - Invalidate Android Studio caches: File β Invalidate Caches
CocoaPods Issues (iOS)
cd ios pod deintegrate pod install --repo-update cd .. flutter build ios
Google Maps Not Showing
- Verify the API key in
secrets.xml(Android) andInfo.plist(iOS) - Ensure Maps SDK + Directions API are enabled in Google Cloud Console
- Check that billing is enabled on the Google Cloud project
- On Android, check
logcatfor "API key not valid" errors
Push Notifications Not Received
- Verify Firebase config files are up to date
- Ensure FCM Server Key is configured in Admin Panel under Settings β Firebase Setup
- On iOS: push notifications require a physical device and a valid APNs key in Firebase
- Test FCM delivery directly from Firebase Console β Cloud Messaging
Location Permission Denied
- On Android: check
AndroidManifest.xmlhasACCESS_FINE_LOCATIONandACCESS_COARSE_LOCATION - On iOS: check
Info.plisthasNSLocationWhenInUseUsageDescriptionandNSLocationAlwaysUsageDescription - If the user denied permission, guide them to Settings β App β Permissions
General Reset
flutter clean flutter pub get dart run build_runner build --delete-conflicting-outputs flutter gen-l10n flutter run
Customization
App Theme & Colors
The global theme is defined in lib/config/theme/. The app supports both
light and dark themes with a ThemeBLoC in features/common/.
Update color values and typography in the theme files β changes propagate automatically
via Flutter's Theme.of(context).
App Icon
# Replace the icon images: # Android: android/app/src/main/res/mipmap-*/ic_launcher.png # iOS: ios/Runner/Assets.xcassets/AppIcon.appiconset/ # Or use the flutter_launcher_icons package for automated generation
Adding a New Feature
-
Create the feature folder under
lib/features/<feature_name>/withdata/,domain/, andpresentation/sub-directories. -
Define Freezed models in
data/models/and rundart run build_runner build. -
Create the BLoC/Cubit in
presentation/bloc/and register it with GetIt using the@injectableannotation. -
Add routes in
lib/config/route/route_config.dart. If the screen should be a dashboard tab, nest it inside theShellRoute.
Modifying the Dashboard Tabs
The bottom navigation is managed by DashboardScreen in
lib/features/dashboard/presentation/screens/dashboard_screen.dart.
The four tabs (Home, Orders, Chat, Account) are defined as ShellRoute
children in route_config.dart. To add or remove a tab, update both
the ShellRoute routes list and the BottomNavigationBar items.
Need help? Contact contact@6amtech.com or visit our website for support.