Environment Setup - utourismboard/explore-uganda-application-documentation GitHub Wiki

Environment Setup Guide

Table of Contents

  1. Development Environment
  2. Flutter Setup
  3. IDE Configuration
  4. Firebase Setup
  5. Local Configuration

Development Environment

System Requirements

  • Operating System: Windows 10/11, macOS 10.15+, or Linux
  • RAM: Minimum 8GB (16GB recommended)
  • Storage: 20GB free space
  • Android Studio or VS Code
  • Git

Required Tools

# Version requirements
Flutter: 3.19.0
Dart: 3.3.0
Node.js: 18.x or later
Firebase CLI: Latest version
Android Studio: Latest version

Flutter Setup

Installing Flutter

  1. Download Flutter SDK from flutter.dev
  2. Extract the archive and add to PATH
  3. Run flutter doctor to verify installation:
flutter doctor

Dart SDK Setup

The Dart SDK comes bundled with Flutter. Verify installation:

dart --version

IDE Configuration

VS Code Setup

  1. Install VS Code
  2. Install required extensions:
    • Flutter
    • Dart
    • Flutter Widget Snippets
    • Firebase Explorer
    • Mermaid Markdown Syntax

Android Studio Setup

  1. Install Android Studio
  2. Install Flutter and Dart plugins
  3. Configure Android SDK
  4. Setup Android Emulator

Editor Settings

{
  "editor.formatOnSave": true,
  "dart.lineLength": 80,
  "dart.previewFlutterUiGuides": true,
  "[dart]": {
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.rulers": [80],
    "editor.selectionHighlight": false,
    "editor.suggestSelection": "first",
    "editor.tabCompletion": "onlySnippets",
    "editor.wordBasedSuggestions": false
  }
}

Firebase Setup

Firebase CLI Installation

npm install -g firebase-tools
firebase login

Project Configuration

  1. Create Firebase project
  2. Download google-services.json
  3. Configure Firebase in app:
// Example firebase configuration
const firebaseConfig = {
  apiKey: "your-api-key",
  authDomain: "your-auth-domain",
  projectId: "your-project-id",
  storageBucket: "your-storage-bucket",
  messagingSenderId: "your-sender-id",
  appId: "your-app-id"
};

Local Configuration

Environment Variables

Create a .env file in the project root:

API_BASE_URL=https://dev-api.exploreuganda.app/v1
MAPS_API_KEY=your_google_maps_key
ENVIRONMENT=development

Development Configuration

// lib/config/app_config.dart
class AppConfig {
  static const String apiBaseUrl = String.fromEnvironment(
    'API_BASE_URL',
    defaultValue: 'https://dev-api.exploreuganda.app/v1',
  );
  
  static const String mapsApiKey = String.fromEnvironment(
    'MAPS_API_KEY',
    defaultValue: '',
  );
}

Running the App

# Development
flutter run --dart-define=ENVIRONMENT=development

# Staging
flutter run --dart-define=ENVIRONMENT=staging

# Production
flutter run --dart-define=ENVIRONMENT=production

Troubleshooting

Common Issues

  1. Flutter Doctor Issues

    • Run flutter doctor -v for detailed diagnostics
    • Follow the suggested fixes
  2. Android Studio Issues

    • Verify Android SDK installation
    • Check PATH variables
    • Update all components
  3. Firebase Setup Issues

    • Verify google-services.json placement
    • Check Firebase configuration
    • Ensure correct package name

Getting Help