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
-
Download the Flutter SDK from the official Flutter website
-
Extract the ZIP file to a location of your choice
-
Add Flutter to your PATH:
- macOS/Linux: Add the following line to your shell profile:
export PATH="$PATH:[PATH_TO_FLUTTER]/flutter/bin" -
Windows: Add Flutter to your PATH environment variable
-
Run the following command to check if Flutter is installed correctly:
flutter doctor -
Follow the instructions to resolve any issues reported by
flutter doctor
Setting Up the IDE
Visual Studio Code
-
Install Visual Studio Code from the official website
-
Install the Flutter extension:
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
-
Search for "Flutter" and install the official Flutter extension
-
Install additional recommended extensions:
- Dart
- GitLens
- Bracket Pair Colorizer
- Prettier - Code formatter
Android Studio
-
Install Android Studio from the official website
-
Install the Flutter plugin:
- Open Android Studio
- Go to File > Settings > Plugins
- Search for "Flutter" and install the plugin
- Restart Android Studio when prompted
Platform-Specific Setup
Android Development
-
Install Android Studio (if not already installed)
-
Install the Android SDK:
- Open Android Studio
- Go to Tools > SDK Manager
-
Install the latest Android SDK Platform and SDK Tools
-
Create an Android Virtual Device (AVD):
- Open Android Studio
- Go to Tools > AVD Manager
-
Create a new virtual device with your preferred configuration
-
Accept Android licenses:
flutter doctor --android-licenses
iOS Development (macOS Only)
-
Install Xcode from the App Store
-
Install Xcode command line tools:
xcode-select --install -
Configure Xcode:
- Open Xcode
- Go to Preferences > Locations
-
Select the command line tools
-
Install CocoaPods:
sudo gem install cocoapods
Web Development
-
Install the Chrome browser (if not already installed)
-
Enable web support in Flutter:
flutter config --enable-web
Setting Up the Project
-
Clone the repository:
git clone [REPOSITORY_URL] cd veea-system-design -
Install Flutter dependencies:
flutter pub get -
Install additional dependencies:
flutter pub run build_runner build -
Check for any remaining issues:
flutter doctor
Running the Application
Running on Different Platforms
-
Android:
flutter run -d android -
iOS (macOS only):
flutter run -d ios -
Web:
flutter run -d chrome -
Desktop (if supported):
flutter run -d windows # Windows flutter run -d macos # macOS flutter run -d linux # Linux
Running Tests
-
Run all tests:
flutter test -
Run tests with coverage:
flutter test --coverage genhtml coverage/lcov.info -o coverage/html -
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:
-
Run code generation when needed:
flutter pub run build_runner build -
For continuous code generation during development:
flutter pub run build_runner watch -
Clean generated files:
flutter pub run build_runner clean
Code Formatting
-
Format all Dart files:
flutter format . -
Format specific file:
flutter format lib/main.dart
Static Analysis
-
Run static analysis:
flutter analyze -
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
- pubspec.yaml: Contains project dependencies and configuration
- analysis_options.yaml: Configures static analysis rules
- .gitignore: Specifies files to ignore in version control
Debugging
Flutter Inspector
- Run the application in debug mode
- Open Flutter DevTools:
flutter pub global activate devtools flutter pub global run devtools - Open the provided URL in your browser
Logging
The application uses structured logging:
-
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'); -
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
-
Build for release:
flutter build apk --release # Android flutter build ios --release # iOS flutter build web --release # Web -
Build with specific target:
flutter build apk --split-per-abi
Performance Profiling
-
Run the application with profiling:
flutter run --profile -
Use Flutter DevTools to analyze performance:
- Open Flutter DevTools
- Navigate to the Performance tab
- Record and analyze performance traces
Troubleshooting
Common Issues
- Flutter doctor issues:
- Follow the instructions provided by
flutter doctor -
Ensure all required tools are installed and configured
-
Dependency conflicts:
- Run
flutter cleanand thenflutter pub get -
Check for version conflicts in pubspec.yaml
-
Build failures:
- Clean the project:
flutter clean - Reinstall dependencies:
flutter pub get -
Regenerate code:
flutter pub run build_runner clean && flutter pub run build_runner build -
Platform-specific issues:
- Check platform-specific setup instructions
- Ensure all required SDKs and tools are installed
Getting Help
- Check the Flutter documentation
- Search the Flutter GitHub issues
- Ask questions on Stack Overflow
- Join the Flutter Discord community
Contributing
Before contributing to the project:
-
Create a new branch for your feature:
git checkout -b feature/your-feature-name -
Make your changes and commit them:
git add . git commit -m "feat: add your feature description" -
Push your branch:
git push origin feature/your-feature-name -
Create a pull request with a detailed description of your changes
-
Ensure all tests pass and code follows the project's style guidelines