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

LayerPackage / TechnologyVersion
FrameworkFlutterSDK (stable)
LanguageDart^3.9.0
State Managementflutter_bloc + BLoC^9.1 / ^9.2
Navigationgo_router + go_transitions^17.2 / ^0.8
Dependency Injectionget_it + injectable^9.2 / ^2.7
Code Generationfreezed + json_serializable^3.2 / ^6.13
Networkinghttp + connectivity_plus^1.6 / ^7.1
FirebaseCore, Messaging, Crashlytics, Analytics^4.7 / ^16.2
Maps & Locationgoogle_maps_flutter + geolocator + location^2.17 / ^14.0 / ^8.0
Permissionspermission_handler^12.0
Imagescached_network_image + image_picker^3.4 / ^1.2
Videovideo_player + chewie^2.11 / ^1.13
Notificationsflutter_local_notifications^21.0
Localizationflutter_localizations + intlSDK / ^0.20
Chatemoji_keyboard_flutter^1.7
Error Trackingfirebase_crashlytics + catcher_2^5.2 / ^2.1
Storageshared_preferences^2.5
OTPotp_autofill^4.1
UI Utilitiesshimmer_animation, skeletonizer, flutter_svg, animated_digit, sliver_tools, google_fontsLatest

Architecture Overview

The deliveryman app follows the same feature-first clean architecture pattern as the customer app:

App Features

πŸš€
Splash & Connectivity Animated splash screen with network connectivity check
πŸ”
Authentication Email/phone login, OTP verification, forgot password, password reset
🏠
Home / Dashboard Overview of assigned orders, delivery stats, and earnings summary
πŸ“¦
Order Management View assigned orders, accept/reject, update status through delivery lifecycle
πŸ“
Delivery Navigation Google Maps route from pickup to delivery with real-time tracking
❌
Cancellation Flow Cancel delivery with reason selection and admin notification
βœ…
Delivery Confirmation Mark orders as delivered with result confirmation screen
πŸ’¬
Live Chat Chat with admin support, emoji keyboard, media file sharing
πŸ””
Notifications Push notifications (Firebase), local notifications, in-app notification list
πŸ‘€
Account & Profile View/edit profile, change password, delete account
βš™οΈ
Settings Language, theme, notification preferences, password setup
πŸ“ž
Contact Us Contact support with form submission
πŸ“„
Terms & Conditions View terms of service within the app
πŸ“Ž
File Viewer View images and media files shared in chat
🌐
Multi-language English, Spanish, Arabic, Hindi, Bangla
πŸŒ™
Dark / Light Theme System-aware theme with manual toggle

Prerequisites

Development Machine Requirements

ToolMinimum VersionNotes
Flutter SDK3.x (stable channel)Run flutter --version to check
Dart SDK^3.9.0Bundled with Flutter
Android StudioHedgehog (2023.1+)Required for Android builds
Xcode15+macOS only β€” required for iOS builds
CocoaPodsLatestmacOS only β€” sudo gem install cocoapods
Java JDK17For Android Gradle builds

External Services Required

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:

TabRouteScreen
Home/homeHomeScreen β€” dashboard with stats
Orders/orderOrdersScreen β€” active & completed orders
Chat/chatChatScreen β€” chat with admin
Account/accountAccountScreen β€” profile & settings

Quick Start

Setup Checklist

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';
  // ...
}
⚠️
This is critical. The default 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

PlatformFileKey
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

  1. 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.
  2. Register Android app Use the package name com.dayonesoft.onemartdeliveryman. Download google-services.json and place it at:
    android/app/google-services.json
    
  3. Register iOS app Use the bundle ID com.dayonesoft.onemartdeliveryman. Download GoogleService-Info.plist and add it to Xcode at:
    ios/Runner/GoogleService-Info.plist
    
  4. 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/updates lib/firebase_options.dart automatically.
  5. 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
ℹ️
Ensure the FCM Server Key is configured in the Admin Panel under Settings β†’ Firebase Setup so that the backend can send notifications to these topics when new orders are assigned.

Google Maps Setup

Step 1 β€” Enable APIs in Google Cloud Console

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:

LanguageCodeARB File
Englishenlib/l10n/arb/app_en.arb
Spanisheslib/l10n/arb/app_es.arb
Arabicarlib/l10n/arb/app_ar.arb
Hindihilib/l10n/arb/app_hi.arb
Banglabnlib/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

  1. Create a new ARB file, e.g. lib/l10n/arb/app_fr.arb. Copy the structure from app_en.arb and translate all strings.
  2. Add the language to the languages list in app_constants.dart:
    LanguageModel(code: 'fr', name: 'French', nativeName: 'FranΓ§ais'),
    
  3. Regenerate localization files:
    flutter gen-l10n
    
ℹ️
Arabic (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

  1. Create a release keystore:
    keytool -genkey -v -keystore android/app/upload-keystore.jks \
      -keyalg RSA -keysize 2048 -validity 10000 -alias upload
    
  2. Create android/key.properties:
    storePassword=<your-store-password>
    keyPassword=<your-key-password>
    keyAlias=upload
    storeFile=upload-keystore.jks
    
⚠️
Keep the keystore (.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

FeatureMethodEndpoint
App ConfigGET/api/v1/delivery-man/config
DashboardGET/api/v1/delivery-man/dashboard
OrdersGET/PUT/api/v1/delivery-man/orders
Map DirectionGET/api/v1/delivery-man/config/map-direction
ProfileGET/PUT/api/v1/delivery-man/profile
FCM TokenPUT/api/v1/delivery-man/profile/fcm-token
Change PasswordPUT/api/v1/delivery-man/profile/change-password
Delete AccountDELETE/api/v1/delivery-man/profile/delete-account
SettingsGET/PUT/api/v1/delivery-man/profile/settings
ChatGET/POST/api/v1/delivery-man/chats
NotificationsGET/PUT/DELETE/api/v1/delivery-man/notifications
TermsGET/api/v1/delivery-man/config/terms
Support / ContactGET/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)

CocoaPods Issues (iOS)

cd ios
pod deintegrate
pod install --repo-update
cd ..
flutter build ios

Google Maps Not Showing

Push Notifications Not Received

Location Permission Denied

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

  1. Create the feature folder under lib/features/<feature_name>/ with data/, domain/, and presentation/ sub-directories.
  2. Define Freezed models in data/models/ and run dart run build_runner build.
  3. Create the BLoC/Cubit in presentation/bloc/ and register it with GetIt using the @injectable annotation.
  4. Add routes in lib/config/route/route_config.dart. If the screen should be a dashboard tab, nest it inside the ShellRoute.

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.