Prerequisites
Before you begin, ensure you have the following installed:Flutter SDK
Flutter SDK 2.2.0 or higher
Dart SDK
Dart SDK (included with Flutter)
Android Studio / Xcode
For Android or iOS development
Git
Version control system
You’ll also need a Firebase project and Mapbox account. We’ll set these up in the following steps.
Installation
Clone the Repository
Clone the Trackmart source code to your local machine:
Replace
yourusername with the actual repository owner.Install Dependencies
Install all required Flutter packages:This will install key dependencies including:
firebase_auth- User authenticationcloud_firestore- Database operationsfirebase_database- Real-time data syncgeolocator- Location servicesflutter_map- Map renderingdio- HTTP networking
Configure Firebase
Create Firebase Project
- Go to Firebase Console
- Click “Add project” and follow the setup wizard
- Enable the following services:
- Authentication (Email and Phone)
- Cloud Firestore
- Realtime Database
- Cloud Messaging
Add Firebase to Your App
- Android
- iOS
- Download
google-services.jsonfrom Firebase Console - Place it in
android/app/ - Verify
android/build.gradleincludes:
android/build.gradle
- Verify
android/app/build.gradleincludes:
android/app/build.gradle
Configure Firestore Security Rules
firestore.rules
Configure Mapbox
Get Mapbox Access Token
- Create an account at Mapbox
- Navigate to your Access Tokens page
- Copy your default public token
Update Map Configuration
Openlib/map.dart and replace the Mapbox access token:lib/map.dart
Enable Location Permissions
- Android
- iOS
Add to
android/app/src/main/AndroidManifest.xml:AndroidManifest.xml
First Run: Create Your Account
When you first launch Trackmart, you’ll see the welcome screen:Authentication Options
Trackmart supports two authentication methods:- Phone Number
- Email
The default authentication method using SMS verification.Steps:
lib/login_page.dart
- Select your country code (default: +254 for Kenya)
- Enter your phone number
- Choose a password
- For new users: Enter your name and agree to terms
- Tap “Sign up” or “Login”
- Enter the SMS verification code sent to your phone
The app creates user profiles in both Firebase Realtime Database and Firestore for optimal performance.
Place Your First Order
After authentication, you’ll land on the home screen with three tabs:Navigate to Request Tab
The middle tab is the “Request” tab where you create orders.
lib/home_page.dart
Select a Driver
You have two options to find drivers:
Option 1: Search by Name/Number
Option 1: Search by Name/Number
Type a driver’s name or phone number in the search field:
lib/home_page.dart
Option 2: Map View
Option 2: Map View
Tap the map icon in the app bar to see nearby drivers with distances and ETAs:The map shows:
lib/home_page.dart
- Your current location (blue pin)
- Available drivers (truck icons)
- Distance to each driver
- Estimated time of arrival
Configure Order Details
Set your order parameters:Quantity: Use +/- buttons or type a number
Unit: Choose “Truck” or “Tonne” from dropdown
Payment: Select “Mobile money” or “Cash”The app automatically calculates total cost based on current rates.
lib/home_page.dart
Submit Request
Tap the blue “Request” button to send your order:You’ll see a confirmation dialog with order summary. Tap “Request” to confirm.
lib/home_page.dart
Testing the App
Manual Testing Checklist
- Phone authentication with SMS verification
- Email authentication with verification link
- Location permissions granted
- User profile creation in Firebase
- View available drivers on map
- Create order with different units and payment methods
- View order in Orders tab
- Chat with driver
- Real-time location updates
Troubleshooting
SMS Verification Not Working
SMS Verification Not Working
Issue: Not receiving SMS codes during phone authentication.Solutions:
- Verify Firebase Authentication is enabled for Phone provider
- Check that your Firebase project has billing enabled (required for SMS)
- Test with a Firebase test phone number in Authentication settings
- Check phone number format includes country code
Map Not Loading
Map Not Loading
Issue: Map tiles not appearing or routes not calculating.Solutions:
- Verify Mapbox access tokens are correct
- Check internet connectivity
- Ensure location permissions are granted
- Check browser console for API errors
Location Permission Denied
Location Permission Denied
Issue: App can’t access device location.Solutions:
- Go to device Settings > Apps > Trackmart > Permissions
- Enable Location permission
- On iOS, check Info.plist has location usage descriptions
- On Android, check AndroidManifest.xml has location permissions
Build Errors
Build Errors
Issue: Flutter build fails with dependency errors.Solutions:
Some packages use older versions. Consider updating
pubspec.yaml with latest compatible versions.Next Steps
Now that you have Trackmart running, explore these topics:Firebase Configuration
Deep dive into Firebase services setup and security rules
Mapbox Setup
Advanced mapping features and customization
Push Notifications
Configure Firebase Cloud Messaging for order updates
Development Guide
Set up your development environment and start building