Menu

Development Environment

Relevant source files

This document provides comprehensive guidance for setting up and configuring the development environment for the Flutter Mobile Project Template. It covers required tools, IDE configurations, and build environments to ensure a consistent development experience across the team.

Required Tools and Versions

The project has specific version requirements to ensure consistency:

ToolRequired VersionPurpose
Flutter^3.27.1SDK for building the application
Dart^3.6.0Programming language
Melos^7.0.0-dev.7Monorepo management
Mason CLI^0.1.2Template scaffolding

Sources: pubspec.yaml2-4 pubspec.yaml28-30

Environment Manager Setup

The project uses mise (a replacement for tools like asdf, nvm, etc.) to manage tool versions. VS Code is configured to use the Flutter and Dart SDK managed by mise.

Sources: .vscode/settings.json3-4 pubspec.yaml40-52

Getting Started

To set up the development environment:

  1. Install mise (https://mise.jdx.dev/)
  2. Clone the repository
  3. Run mise use in the project root to install required tools
  4. Run melos bootstrap to set up the workspace

The melos bootstrap command will:

  • Verify Flutter and Dart SDK versions
  • Install dependencies for all packages
  • Run post-bootstrap hooks (update lints, generate labels)

Sources: pubspec.yaml72-74 pubspec.yaml76-82

IDE Setup

The project supports both VS Code and IntelliJ IDEA with custom configurations.

VS Code Configuration

VS Code is the primary IDE with detailed configuration provided:

The following extensions are recommended for VS Code:

Extension IDPurpose
dart-code.dart-codeDart language support
dart-code.flutterFlutter framework support
blaugold.melos-codeMelos integration
djbkwon.flutter-dependency-docsDocumentation for dependencies
esbenp.prettier-vscodeJSON formatting
DavidAnson.vscode-markdownlintMarkdown linting
google.arb-editorARB localization editor

Sources: .vscode/extensions.json2-11

Launch Configurations

VS Code includes launch configurations for different environments:

ConfigurationPurposeArguments
dev-debugDevelopment environment--dart-define-from-file=flavor/dev.json
stg-debugStaging environment--dart-define-from-file=flavor/stg.json
prd-debugProduction environment--dart-define-from-file=flavor/prd.json
ui-catalogUI component catalog-
samples-github-appGitHub sample app-

Sources: .vscode/launch.json6-50

IntelliJ IDEA / Android Studio

IntelliJ IDEA is supported with specific run configurations:

The project includes the following run configurations for IntelliJ:

  • ui-catalog: UI component catalog
  • samples-github-app: GitHub sample app

Note: Automatic Melos configuration in IntelliJ is disabled to support custom build environments.

Sources: pubspec.yaml42-46 .idea/runConfigurations/ui_catalog.xml1-7 .idea/runConfigurations/samples_github_app.xml1-6

Build Configurations

The project uses environment-specific configurations to support different deployment targets.

Environment Flavors

The application supports three environments:

To launch the app with a specific environment flavor:

# Development
flutter run --dart-define-from-file=flavor/dev.json

# Staging
flutter run --dart-define-from-file=flavor/stg.json

# Production
flutter run --dart-define-from-file=flavor/prd.json

Sources: .vscode/launch.json8-35

Melos Workspace Management

The project uses Melos to manage the monorepo structure and provide useful commands for development tasks.

Workspace Structure

Sources: pubspec.yaml5-26

Melos Commands

Melos provides a set of predefined commands to streamline development:

CommandDescription
melos bootstrapSet up workspace and install dependencies
melos run genGenerate code (build_runner and l10n)
melos run fixApply Dart fixes to all packages
melos run fix:customApply custom lint fixes
melos run testRun all tests across packages
melos run upgradeUpgrade dart dependencies
melos run golden_testUpdate golden files for UI tests

Sources: pubspec.yaml75-212

Development Workflow

A typical development workflow using this template follows these steps:

  1. Setup: Install required tools via mise
  2. Bootstrap: Run melos bootstrap to initialize workspace
  3. Development: Make code changes
  4. Generate: Run melos run gen for code generation
  5. Test: Run melos run test to verify changes
  6. Lint: Run melos run fix to apply fixes

Sources: pubspec.yaml96-100 pubspec.yaml142-156

Additional Tools

Spell Checking

The project includes configuration for spell checking with cspell:

# Install dependencies
bun install

# Run spell checking
npx cspell "**/*.{dart,md,json,yaml}"

Sources: package.json2-8 bun.lock1-241

Mason CLI

Mason CLI is used for code generation and scaffolding:

# Install mason
dart pub global activate mason_cli

# List available bricks
mason list

Sources: pubspec.yaml29 .gitignore14-19

Summary

This development environment is designed to ensure consistency across team members and simplify common development tasks. By following the setup instructions and using the provided tools, developers can work efficiently with this Flutter project template.

For information about CI/CD pipelines and automation, see CI/CD and Automation. For information about the application architecture, see Application Architecture.