Skip to content

Development Environment Setup Guide

This guide walks you through setting up a development environment for working on the Veea system.

Prerequisites

Before you begin, ensure you have the following installed:

  • Git: For version control
  • Flutter SDK: Version 3.0.0 or higher
  • Dart SDK: Included with Flutter
  • IDE: Visual Studio Code or Android Studio
  • Platform-specific tools:
  • For Android: Android Studio and Android SDK
  • For iOS: Xcode (macOS only)
  • For Web: Chrome browser

Installing Flutter

  1. Download the Flutter SDK from the official Flutter website

  2. Extract the ZIP file to a location of your choice

  3. Add Flutter to your PATH:

  4. macOS/Linux: Add the following line to your shell profile:
    export PATH="$PATH:[PATH_TO_FLUTTER]/flutter/bin"
    
  5. Windows: Add Flutter to your PATH environment variable

  6. Run the following command to check if Flutter is installed correctly:

    flutter doctor
    

  7. Follow the instructions to resolve any issues reported by flutter doctor

Setting Up the IDE

Visual Studio Code

  1. Install Visual Studio Code from the official website

  2. Install the Flutter extension:

  3. Open VS Code
  4. Go to Extensions (Ctrl+Shift+X)
  5. Search for "Flutter" and install the official Flutter extension

  6. Install additional recommended extensions:

  7. Dart
  8. GitLens
  9. Bracket Pair Colorizer
  10. Prettier - Code formatter

Android Studio

  1. Install Android Studio from the official website

  2. Install the Flutter plugin:

  3. Open Android Studio
  4. Go to File > Settings > Plugins
  5. Search for "Flutter" and install the plugin
  6. Restart Android Studio when prompted

Platform-Specific Setup

Android Development

  1. Install Android Studio (if not already installed)

  2. Install the Android SDK:

  3. Open Android Studio
  4. Go to Tools > SDK Manager
  5. Install the latest Android SDK Platform and SDK Tools

  6. Create an Android Virtual Device (AVD):

  7. Open Android Studio
  8. Go to Tools > AVD Manager
  9. Create a new virtual device with your preferred configuration

  10. Accept Android licenses:

    flutter doctor --android-licenses
    

iOS Development (macOS Only)

  1. Install Xcode from the App Store

  2. Install Xcode command line tools:

    xcode-select --install
    

  3. Configure Xcode:

  4. Open Xcode
  5. Go to Preferences > Locations
  6. Select the command line tools

  7. Install CocoaPods:

    sudo gem install cocoapods
    

Web Development

  1. Install the Chrome browser (if not already installed)

  2. Enable web support in Flutter:

    flutter config --enable-web
    

Setting Up the Project

  1. Clone the repository:

    git clone [REPOSITORY_URL]
    cd veea-system-design
    

  2. Install Flutter dependencies:

    flutter pub get
    

  3. Install additional dependencies:

    flutter pub run build_runner build
    

  4. Check for any remaining issues:

    flutter doctor
    

Running the Application

Running on Different Platforms

  1. Android:

    flutter run -d android
    

  2. iOS (macOS only):

    flutter run -d ios
    

  3. Web:

    flutter run -d chrome
    

  4. Desktop (if supported):

    flutter run -d windows  # Windows
    flutter run -d macos    # macOS
    flutter run -d linux    # Linux
    

Running Tests

  1. Run all tests:

    flutter test
    

  2. Run tests with coverage:

    flutter test --coverage
    genhtml coverage/lcov.info -o coverage/html
    

  3. Run specific test file:

    flutter test test/widget_test.dart
    

Development Workflow

Code Generation

The project uses code generation for dependency injection and other features:

  1. Run code generation when needed:

    flutter pub run build_runner build
    

  2. For continuous code generation during development:

    flutter pub run build_runner watch
    

  3. Clean generated files:

    flutter pub run build_runner clean
    

Code Formatting

  1. Format all Dart files:

    flutter format .
    

  2. Format specific file:

    flutter format lib/main.dart
    

Static Analysis

  1. Run static analysis:

    flutter analyze
    

  2. Fix analysis issues automatically:

    dart fix --apply
    

Environment Configuration

Environment Variables

Create a .env file in the root directory with the following variables:

# API Configuration
API_BASE_URL=https://api.veea.com
API_KEY=your_api_key_here

# Database Configuration
DATABASE_URL=your_database_url_here

# Authentication
AUTH_CLIENT_ID=your_client_id_here
AUTH_CLIENT_SECRET=your_client_secret_here

# AI Configuration
AI_MODEL_ENDPOINT=https://ai.veea.com/api
AI_API_KEY=your_ai_api_key_here

Configuration Files

  1. pubspec.yaml: Contains project dependencies and configuration
  2. analysis_options.yaml: Configures static analysis rules
  3. .gitignore: Specifies files to ignore in version control

Debugging

Flutter Inspector

  1. Run the application in debug mode
  2. Open Flutter DevTools:
    flutter pub global activate devtools
    flutter pub global run devtools
    
  3. Open the provided URL in your browser

Logging

The application uses structured logging:

  1. Add logging to your code:

    import 'package:logging/logging.dart';
    
    final _logger = Logger('MyClass');
    _logger.info('This is an info message');
    _logger.warning('This is a warning');
    _logger.severe('This is an error');
    

  2. Configure logging in main.dart:

    import 'package:logging/logging.dart';
    
    void main() {
      Logger.root.level = Level.ALL;
      Logger.root.onRecord.listen((record) {
        print('${record.level.name}: ${record.time}: ${record.message}');
      });
    
      runApp(MyApp());
    }
    

Performance Optimization

Build Optimization

  1. Build for release:

    flutter build apk --release    # Android
    flutter build ios --release    # iOS
    flutter build web --release    # Web
    

  2. Build with specific target:

    flutter build apk --split-per-abi
    

Performance Profiling

  1. Run the application with profiling:

    flutter run --profile
    

  2. Use Flutter DevTools to analyze performance:

  3. Open Flutter DevTools
  4. Navigate to the Performance tab
  5. Record and analyze performance traces

Troubleshooting

Common Issues

  1. Flutter doctor issues:
  2. Follow the instructions provided by flutter doctor
  3. Ensure all required tools are installed and configured

  4. Dependency conflicts:

  5. Run flutter clean and then flutter pub get
  6. Check for version conflicts in pubspec.yaml

  7. Build failures:

  8. Clean the project: flutter clean
  9. Reinstall dependencies: flutter pub get
  10. Regenerate code: flutter pub run build_runner clean && flutter pub run build_runner build

  11. Platform-specific issues:

  12. Check platform-specific setup instructions
  13. Ensure all required SDKs and tools are installed

Getting Help

  1. Check the Flutter documentation
  2. Search the Flutter GitHub issues
  3. Ask questions on Stack Overflow
  4. Join the Flutter Discord community

Contributing

Before contributing to the project:

  1. Create a new branch for your feature:

    git checkout -b feature/your-feature-name
    

  2. Make your changes and commit them:

    git add .
    git commit -m "feat: add your feature description"
    

  3. Push your branch:

    git push origin feature/your-feature-name
    

  4. Create a pull request with a detailed description of your changes

  5. Ensure all tests pass and code follows the project's style guidelines