GitHub - opensoft/flutterBench: This is a devcontainer setup for Flutter development. Scripts for setting up new devcontainer projects with well manered containers.

๐Ÿš€ FlutterBench - Flutter Development Environment

A comprehensive Flutter development environment with DevContainer templates and project creation tools.

๐Ÿงฑ Container Architecture (Layered)

FlutterBench is standardizing on the layered workBenches model:

  • Layer 0: workbench-base:{user}
  • Layer 1a: devbench-base:{user}
  • Layer 2: flutter-bench:{user} (bench-specific tools)

Legacy Note

Any monolithic .devcontainer/ Dockerfiles are deprecated. The layered images are the source of truth going forward.

๐ŸŽฏ Purpose

FlutterBench provides two ways to create Flutter projects with DevContainer support:

  1. ๐Ÿค– Automated Setup - Use new-flutter-project.sh for quick, standardized project creation
  2. ๐Ÿ”ง Manual Setup - Copy templates manually for maximum customization control

๐Ÿ“ Structure

flutterBench/
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ new-flutter-project.sh        # Automated project creation
โ”‚   โ”œโ”€โ”€ new-dartwing-project.sh       # DartWing project creation  
โ”‚   โ”œโ”€โ”€ update-flutter-project.sh     # Update existing projects
โ”‚   โ”œโ”€โ”€ launch-devbench.sh           # Launch development container
โ”‚   โ””โ”€โ”€ start-monster.sh             # Container startup script
โ”œโ”€โ”€ templates/
โ”‚   โ””โ”€โ”€ flutter-devcontainer-template/  # DevContainer template
โ”‚       โ”œโ”€โ”€ .devcontainer/            # VS Code DevContainer config
โ”‚       โ”œโ”€โ”€ .vscode/                  # VS Code settings & tasks
โ”‚       โ”œโ”€โ”€ scripts/
โ”‚       โ”‚   โ”œโ”€โ”€ manual-setup-project.sh  # Manual setup validation
โ”‚       โ”‚   โ””โ”€โ”€ README.md             # Script usage guide
โ”‚       โ”œโ”€โ”€ .env.example             # Environment template
โ”‚       โ””โ”€โ”€ README.md               # Template documentation
โ””โ”€โ”€ docs/                           # Additional documentation

๐Ÿš€ Getting Started

Option 1: Automated Setup (Recommended)

Best for: New projects, standardized setup, quick start

# Navigate to flutterBench scripts
cd /path/to/workBenches/devBenches/flutterBench/scripts

# Create new Flutter project with DevContainer
./new-flutter-project.sh my-flutter-app

# Or specify custom target directory  
./new-flutter-project.sh my-flutter-app ~/projects/special-projects

What it does automatically:

  • โœ… Creates Flutter project using flutter create
  • โœ… Copies and configures DevContainer template
  • โœ… Sets up environment variables (.env)
  • โœ… Configures user UID/GID for proper permissions
  • โœ… Sets up infrastructure paths
  • โœ… Includes specKit for spec-driven development
  • โœ… Ready to open in VS Code

Option 2: Manual Setup (Advanced)

Best for: Existing projects, template customization, learning/understanding

# 1. Create or navigate to your Flutter project
flutter create my-flutter-app  # or use existing project
cd my-flutter-app

# 2. Copy template files
TEMPLATE_PATH="/path/to/workBenches/devBenches/flutterBench/templates/flutter-devcontainer-template"
cp -r "$TEMPLATE_PATH/.devcontainer" .
cp -r "$TEMPLATE_PATH/.vscode" .
cp -r "$TEMPLATE_PATH/scripts" .
cp "$TEMPLATE_PATH/.env.example" .

# 3. Set up environment configuration
cp .env.example .env
# Edit .env file with your project settings...

# 4. Validate setup (IMPORTANT!)
./scripts/manual-setup-project.sh

When to use manual setup:

  • โœ… Adding DevContainer to existing Flutter project
  • โœ… Need to customize template before applying
  • โœ… Working with non-standard directory structure
  • โœ… Want to understand how the template works
  • โœ… Debugging container configuration issues

๐Ÿ“‹ Key Differences

Feature Automated Setup Manual Setup
Speed โšก Fast (single command) ๐Ÿข Multiple steps required
Control ๐ŸŽฏ Standardized ๐Ÿ”ง Full customization
Validation โœ… Built-in ๐Ÿ“‹ Manual validation required
Learning ๐Ÿ“ฆ Black box ๐ŸŽ“ Educational
Best For New projects Existing projects, customization
Difficulty ๐ŸŸข Easy ๐ŸŸก Intermediate

๐Ÿ”ง Manual Setup Validation

โš ๏ธ IMPORTANT: When using manual setup, you MUST run the validation script:

./scripts/manual-setup-project.sh

This script:

  • ๐Ÿ” Creates .env from .env.example if missing
  • โœ… Validates all required environment variables
  • ๐Ÿ”ง Checks variable formats and values
  • ๐Ÿณ Verifies Docker environment
  • ๐Ÿ“‹ Tests container configuration
  • ๐Ÿ—๏ธ Validates infrastructure paths

๐Ÿ“– For detailed manual setup guidance, see templates/flutter-devcontainer-template/scripts/README.md

๐Ÿ’ก Which Approach Should I Use?

Use Automated Setup when:

  • โœ… Creating a new Flutter project from scratch
  • โœ… You want standard workBenches project structure
  • โœ… You need to get started quickly
  • โœ… You trust the default configuration
  • โœ… You're new to DevContainers

Use Manual Setup when:

  • โœ… Adding DevContainer to existing Flutter project
  • โœ… You need custom template modifications
  • โœ… Working with unique directory structures
  • โœ… You want to learn how DevContainers work
  • โœ… Debugging container issues
  • โœ… You need maximum control over the setup process

โš™๏ธ Centralized Configuration Philosophy

Key Principle: The .env file is the single source of truth for ALL project and user-specific configuration.

What This Means:

  • โœ… Template files remain untouched - devcontainer.json, docker-compose.yml, etc. are never modified
  • โœ… All customization via environment variables - container names, user settings, versions, ports
  • โœ… Project-specific settings isolated - each project has its own .env file
  • โœ… Easy template updates - template improvements don't conflict with your settings

Configuration Examples:

# .env file controls everything:
PROJECT_NAME=dartwing
APP_CONTAINER_SUFFIX=app           # Results in: dartwing-app
SERVICE_CONTAINER_SUFFIX=gateway   # Results in: dartwing-gateway  
USER_UID=1000
FLUTTER_VERSION=3.24.0
COMPOSE_PROJECT_NAME=dartwingers

Result: Template files use ${PROJECT_NAME}-${APP_CONTAINER_SUFFIX} โ†’ resolves to dartwing-app

๐Ÿš€ Next Steps After Setup

Regardless of which setup method you used:

  1. Open in VS Code: code .
  2. Reopen in Container: Click prompt or Ctrl+Shift+P โ†’ "Dev Containers: Reopen in Container"
  3. Wait for build: First time takes 2-5 minutes
  4. Start coding: Container includes Flutter SDK, Android tools, and VS Code extensions

๐Ÿ”ง Available Scripts

Project Creation

  • scripts/new-flutter-project.sh - Create new Flutter project with DevContainer
  • scripts/new-dartwing-project.sh - Create new DartWing project variant

Project Management

  • scripts/update-flutter-project.sh - Update existing project to latest template
  • templates/.../scripts/manual-setup-project.sh - Validate manual setup

Development Environment

  • scripts/launch-devbench.sh - Launch development container
  • scripts/start-monster.sh - Start container infrastructure

๐Ÿ“š Documentation

๐ŸŽฏ Template Features

The DevContainer template includes:

  • ๐Ÿณ Lightweight container (~500MB vs 2GB+ FlutterBench)
  • ๐Ÿ”ง Centralized configuration - ALL project and user settings in .env file only
  • ๐Ÿ“ No template file modification - template files remain untouched, use environment variables
  • ๐Ÿท๏ธ Configurable container naming - customize app and service container names via .env
  • ๐Ÿ“ฑ Shared ADB infrastructure (connects to external ADB server)
  • โš™๏ธ VS Code integration (tasks, launch configs, extensions)
  • ๐Ÿ—๏ธ Proper user permissions (UID/GID matching)
  • ๐Ÿ”„ Hot reload support (port forwarding configured)
  • ๐Ÿงช Testing support (launch configurations)
  • ๐Ÿ“‹ Spec-driven development (includes specKit)

๐Ÿ—๏ธ Container Philosophy

  • FlutterBench = Heavy development workbench (~2GB, all tools)
  • Project Containers = Lightweight project-specific environment (~500MB)

Use FlutterBench for heavy development, project containers for debugging and light development.