Skip to main content

Overview

Trackmart uses a variety of Flutter packages to implement features like authentication, real-time database, mapping, messaging, and more. This page documents all dependencies, their versions, and their purposes.

Environment

environment:
  sdk: ">=2.2.0 <3.0.0"
The application requires Dart SDK version 2.2.0 or higher, but below 3.0.0. Consider updating to support Dart 3.0+ for better performance and features.

Core Dependencies

Flutter SDK

Version: SDKPurpose: Core Flutter frameworkThe fundamental Flutter SDK that provides widgets, rendering, and platform integration.
dependencies:
  flutter:
    sdk: flutter

Firebase & Backend Services

Trackmart relies heavily on Firebase for backend services including authentication, database, storage, and messaging.

firebase_auth

Version: ^0.11.1+7Purpose: User authenticationHandles phone number authentication, email/password login, and user session management.Key Features:
  • Phone OTP verification
  • Email verification
  • User state persistence
  • Sign in/out functionality

cloud_firestore

Version: 0.12.7+1Purpose: NoSQL cloud databaseReal-time database for user profiles, driver information, and chat messages.Collections:
  • users: User profiles
  • drivers: Driver profiles
  • messages: Chat data

firebase_database

Version: 3.0.5Purpose: Real-time databaseHandles real-time order requests, location updates, and driver-buyer interactions.Features:
  • Real-time synchronization
  • Offline persistence
  • Hierarchical data structure

firebase_storage

Version: 3.0.4Purpose: File storageStores user profile photos, chat images, and other media files.Usage:
  • Profile picture uploads
  • Chat image sharing
  • Media caching
Version: 5.1.2Purpose: Push notificationsSends real-time notifications for order updates, messages, and delivery status.Features:
  • FCM token management
  • Background message handling
  • Notification payload processing
  • Device-to-device messaging
Implementation: See lib/root_page.dart:21-46
Firebase packages are using older versions. Consider upgrading to the latest versions for improved security and features:
  • firebase_auth: Latest is 4.x.x
  • cloud_firestore: Latest is 4.x.x
  • firebase_storage: Latest is 11.x.x
  • firebase_messaging: Latest is 14.x.x

Location & Mapping

Version: 5.1.1+1Purpose: GPS location servicesProvides real-time location tracking for users and drivers.Features:
  • Current position retrieval
  • Continuous location updates
  • Location accuracy settings
  • Distance calculations
Key Methods:
getCurrentPosition(desiredAccuracy: LocationAccuracy.best)
getPositionStream(locationOptions)
Usage in app: Tracks user location for delivery coordination (see lib/home_page.dart:193-203)
Version: 0.7.0+2Purpose: Interactive map widgetDisplays maps with markers, routes, and interactive features.Features:
  • Customizable map layers
  • Marker placement
  • Polyline drawing
  • Zoom and pan controls
Implementation: lib/map.dart for driver location and route visualization
Version: 0.1.0Purpose: Route drawingDecodes polyline strings and draws routes on maps between user and driver locations.Usage:
  • Delivery route visualization
  • Distance calculation
  • ETA estimation
Version: ^3.1.0Purpose: Runtime permissionsManages location, camera, and storage permissions required by the app.Permissions Handled:
  • Location (always/when in use)
  • Camera (for profile photos)
  • Storage (for image caching)
  • Notifications

Networking & HTTP

Version: 2.1.13Purpose: HTTP clientPowerful HTTP client for API requests, including currency conversion and external data fetching.Features:
  • Request/response interceptors
  • FormData support
  • Timeout configuration
  • Error handling
Usage in app: Currency conversion for pricing (see lib/home_page.dart:75)

Local Storage

sqflite

Version: Latest (no version specified)Purpose: SQLite databaseLocal database for offline data persistence and caching.Stored Data:
  • Order history
  • Cached driver info
  • Offline messages

shared_preferences

Version: 0.5.3+4Purpose: Key-value storageStores simple data like user preferences and settings.Stored Data:
  • User display name
  • Phone number
  • Photo URL
  • App settings
Version: Latest (no version specified)Purpose: File path manipulationProvides utilities for working with file and directory paths, especially for SQLite database location.Common Usage:
import 'package:path/path.dart' as path;
final dbPath = path.join(await getDatabasesPath(), 'trackmart.db');

UI & User Experience

Version: 1.1.1Purpose: Image cachingEfficiently loads and caches network images with placeholder support.Features:
  • Automatic disk and memory caching
  • Placeholder widgets during loading
  • Error handling
  • Progressive loading
Usage: Profile photos and chat images (see lib/home_page.dart:344-358)
Version: 0.6.0+17Purpose: Camera and gallery accessAllows users to select images from gallery or take photos with camera.Features:
  • Camera capture
  • Gallery selection
  • Image compression
  • iOS and Android support
Usage: Profile photo upload in settings
Version: 1.0.3Purpose: Star rating widgetCustomizable star rating widget for rating drivers and deliveries.Features:
  • Half-star support
  • Custom star icons
  • Touch interaction
  • Read-only mode
Usage: Driver and delivery ratings in order history
Version: 3.1.0Purpose: Toast notificationsShows brief, non-intrusive messages to users.Features:
  • Customizable duration
  • Position control
  • Background and text colors
  • Gravity settings
Usage: Success/error messages throughout the app

Notifications

Version: 0.8.0Purpose: Local notificationsDisplays notifications on the device for incoming messages and order updates.Features:
  • Android notifications
  • iOS notifications
  • Custom notification sounds
  • Notification actions
  • Scheduled notifications
Implementation: See lib/root_page.dart:80-96 for notification configuration

Input & Forms

flutter_masked_text

Version: ^0.8.0Purpose: Masked text inputFormats text input with masks (e.g., phone numbers, credit cards).Usage:
  • Phone number formatting
  • Card number input
  • Custom input patterns

country_code_picker

Version: 1.1.7Purpose: Country code selectionDropdown widget for selecting country codes during phone authentication.Features:
  • Country flags
  • Search functionality
  • Dial codes
  • Country names

Utilities

Version: 0.15.8Purpose: InternationalizationProvides date formatting, number formatting, and localization support.Features:
  • Date/time formatting
  • Number formatting
  • Currency formatting
  • Message translation
Usage Example:
import 'package:intl/intl.dart';
final formatter = DateFormat('yyyy-MM-dd HH:mm');
String formatted = formatter.format(DateTime.now());
Version: ^4.0.3Purpose: Launch URLsOpens external URLs, phone calls, emails, and other URI schemes.Capabilities:
  • Web URLs (browser)
  • Tel: links (phone dialer)
  • Mailto: links (email client)
  • SMS and other schemes
Usage: Contact page phone/email links (see lib/contact.dart)
Version: 0.6.2+1Purpose: Share functionalityEnables sharing app content via native share dialog.Features:
  • Text sharing
  • File sharing
  • Platform-specific dialogs
Usage: Invite functionality in drawer menu (see lib/home_page.dart:424-428)

Dev Dependencies

Development and testing dependencies:
Version: SDKPurpose: Flutter testing frameworkProvides testing utilities for unit and widget tests.
Version: SDKPurpose: Integration testingDrives the app from a separate process for end-to-end testing.
Version: anyPurpose: Core testing libraryDart’s testing framework for unit tests.
Version: ^0.0.12Purpose: BDD testingBehavior-driven development testing with Gherkin syntax.Features:
  • Given-When-Then syntax
  • Readable test scenarios
  • Step definitions

Dependency Management

Installing Dependencies

To install all dependencies listed in pubspec.yaml:
flutter pub get

Updating Dependencies

To update dependencies to the latest compatible versions:
flutter pub upgrade

Checking for Outdated Packages

To see which packages have newer versions available:
flutter pub outdated
Many dependencies in this project use older versions. Before upgrading, carefully review breaking changes and test thoroughly.
Consider upgrading these packages for better performance, security, and features:
PackageCurrentLatestNotes
firebase_auth0.11.1+74.x.xBreaking changes
cloud_firestore0.12.7+14.x.xBreaking changes
geolocator5.1.1+110.x.xBreaking changes
flutter_map0.7.0+26.x.xMajor updates
cached_network_image1.1.13.x.xPerformance improvements
dio2.1.135.x.xNull safety

Migration to Null Safety

This project was built before Dart’s null safety feature. Consider migrating to null safety for better code quality:
  1. Update Dart SDK to 2.12.0 or higher
  2. Run dart migrate to analyze and migrate code
  3. Update all dependencies to null-safe versions
  4. Test thoroughly after migration

Common Issues & Solutions

Problem: CocoaPods dependencies fail to installSolution:
cd ios
rm Podfile.lock
rm -rf Pods
pod cache clean --all
pod install
cd ..
flutter clean
flutter pub get
Problem: Android build fails with dependency conflictsSolution:
  1. Update android/build.gradle with compatible versions
  2. Clean build:
    cd android
    ./gradlew clean
    cd ..
    flutter clean
    flutter pub get
    
  3. Rebuild:
    flutter build apk
    
Problem: Multiple packages require different versions of the same dependencySolution:
  1. Use dependency_overrides in pubspec.yaml (temporary fix)
  2. Update conflicting packages to compatible versions
  3. Check package compatibility at pub.dev

Additional Resources

pub.dev

Official Dart package repository

Flutter Packages

Flutter package documentation

Firebase Flutter

Firebase for Flutter setup guide

Package Management

Dart package management guide

Next Steps

Installation

Set up your development environment

Project Structure

Understand the codebase organization

Build docs developers (and LLMs) love