Skip to main content
This guide walks you through setting up the MND mobile app development environment.

Prerequisites

Flutter SDK

Install Flutter SDK version 3.0.0 or higher:
# Verify Flutter installation
flutter --version

# Should show:
# Flutter 3.x.x • channel stable
# Dart 3.x.x
Download Flutter from: https://docs.flutter.dev/get-started/install

Platform-Specific Requirements

Android Development

  1. Android Studio with:
    • Android SDK (API level 21+)
    • Android SDK Platform-Tools
    • Android SDK Build-Tools
  2. Android Emulator or physical device with USB debugging enabled
  3. Verify Android setup:
    flutter doctor -v
    

iOS Development (macOS only)

  1. Xcode (latest version from App Store)
  2. CocoaPods:
    sudo gem install cocoapods
    
  3. iOS Simulator or physical device
  4. Verify iOS setup:
    flutter doctor -v
    

Clone Repository

cd ~/workspace/source
git clone <repository-url>
cd mnd_flutter

Install Dependencies

Install all Flutter packages defined in pubspec.yaml:
flutter pub get
This installs:
  • provider - State management
  • http - HTTP client
  • google_maps_flutter - Map integration
  • flutter_dotenv - Environment variables
  • shared_preferences - Local storage
  • And more (see pubspec.yaml)

Configuration

Create a .env file in the project root:
touch .env
Add your Google Maps API key:
GOOGLE_DM_API_KEY=your_google_maps_api_key_here
See the Configuration Guide for detailed environment setup.

Configure Backend API URL

Edit lib/config/api_config.dart to point to your backend server:
class ApiConfig {
  // For Android Emulator (connects to host machine)
  static const String baseUrl = 'http://10.0.2.2:3000/api';
  
  // For physical device on same Wi-Fi
  // static const String baseUrl = 'http://192.168.0.114:3000/api';
  
  // For iOS Simulator
  // static const String baseUrl = 'http://localhost:3000/api';
}

Platform-Specific Setup

Android Setup

  1. Enable Google Maps in android/app/src/main/AndroidManifest.xml:
    <application>
      <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="YOUR_GOOGLE_MAPS_API_KEY"/>
    </application>
    
  2. Minimum SDK: Ensure android/app/build.gradle has:
    minSdkVersion 21
    

iOS Setup

  1. Install CocoaPods dependencies:
    cd ios
    pod install
    cd ..
    
  2. Enable Google Maps in ios/Runner/AppDelegate.swift:
    import GoogleMaps
    
    GMSServices.provideAPIKey("YOUR_GOOGLE_MAPS_API_KEY")
    
  3. Minimum iOS version: Ensure ios/Podfile has:
    platform :ios, '11.0'
    

Running the App

List Available Devices

flutter devices

Run on Android

# Run on connected Android device/emulator
flutter run

# Or specify device
flutter run -d <device-id>

Run on iOS

# Run on connected iOS device/simulator
flutter run

# Or specify simulator
flutter run -d "iPhone 14 Pro"

Development with Hot Reload

While the app is running:
  • Press r to hot reload
  • Press R to hot restart
  • Press q to quit

Building for Release

Android APK

flutter build apk --release
Output: build/app/outputs/flutter-apk/app-release.apk

Android App Bundle (for Play Store)

flutter build appbundle --release

iOS IPA

flutter build ios --release
Then use Xcode to archive and upload to App Store.

Troubleshooting

Flutter Doctor Issues

Run diagnostics:
flutter doctor -v
Fix any issues marked with ❌ or ⚠️

Dependency Conflicts

flutter pub upgrade
flutter pub get

Clear Build Cache

flutter clean
flutter pub get
flutter run

Android License Issues

flutter doctor --android-licenses

iOS CocoaPods Issues

cd ios
rm -rf Pods Podfile.lock
pod install --repo-update
cd ..

Development Tools

  • VS Code with Flutter/Dart extensions
  • Android Studio with Flutter plugin
Both provide:
  • Code completion
  • Hot reload
  • Debugging
  • Widget inspector

Useful Commands

# Check for outdated packages
flutter pub outdated

# Analyze code
flutter analyze

# Run tests
flutter test

# Format code
flutter format lib/

Next Steps