Menu

Getting Started

Relevant source files

This page guides you through the initial setup process for the Flutter Mobile Project Template. It covers how to create a new project from the template, set up your development environment, customize basic project settings, and run the app for the first time. For more detailed information on the project structure and architecture, see Project Structure.

Prerequisites

Before getting started, ensure you have the following tools installed on your system:

  • Git
  • Mise - Used for Flutter version management
  • A compatible IDE (Visual Studio Code or IntelliJ IDEA)

Sources: .vscode/settings.json1-39

Development Environment Setup

Flutter SDK Setup

The project uses Flutter 3.27.1-stable, which can be automatically installed and managed using mise.

# Install mise if you haven't already
# Then install the required Flutter version
mise use flutter@3.27.1-stable

The project is configured to work with this Flutter version through the mise configuration.

Sources: .vscode/settings.json3-4

IDE Setup

Visual Studio Code

VSCode is the recommended IDE with the following extensions:

Extension IDPurpose
dart-code.dart-codeDart language support
dart-code.flutterFlutter framework support
blaugold.melos-codeMelos monorepo support
djbkwon.flutter-dependency-docsFlutter dependency documentation
esbenp.prettier-vscodeCode formatting
DavidAnson.vscode-markdownlintMarkdown linting
google.arb-editorLocalization file editing

The repository includes pre-configured settings for VSCode:

  • File nesting for generated Dart files
  • GitHub Copilot configuration (if applicable)
  • Formatting settings
  • ARB editor configuration

You can launch the application using the provided launch configurations:

Dev: dev-debug
Staging: stg-debug
Production: prd-debug
UI Catalog: ui-catalog

Sources: .vscode/extensions.json1-12 .vscode/settings.json1-39 .vscode/launch.json1-52

IntelliJ IDEA

IntelliJ IDEA is also supported with run configurations included in the project:

  • ui-catalog
  • samples-github-app

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

Development Environment Flow

This diagram illustrates how the development environment is set up:

Sources: .vscode/launch.json1-52 .idea/runConfigurations/ui_catalog.xml1-7 .idea/runConfigurations/samples_github_app.xml1-6

Project Initialization

Creating a New Project

To start a new project using this template:

  1. Go to the Flutter Mobile Project Template repository
  2. Click "Use this template" > "Create a new repository"
  3. Enter your repository details and create the repository
  4. Clone your new repository to your local machine

Initialization Workflow

When you create a new project from the template, a GitHub Actions workflow will run automatically to perform initial setup tasks:

Sources: .github/initialization/README.md1-7

Initial Customization

After creating your project from the template, you'll need to perform several customization steps. The initialization workflow creates issues in your repository to guide you through these steps.

Renaming Application ID

One of the first tasks is to rename the application ID:

  1. Navigate to the /tools directory
  2. Run the rename script:
cd tools
chmod +x rename-application-id.sh # if needed
./rename-application-id.sh "com.example.android.app" "com.example.ios.app"

This script updates:

  • Application ID definitions in flavor JSON files
  • The namespace in build.gradle
  • The MainActivity.kt file with the new package name
  • Bundle IDs for iOS

Sources: .github/initialization/RENAME_APPLICATION_ID.md1-33

Setting Up GitHub Auto-Assignment

The project includes a workflow to automatically assign reviewers to Pull Requests. You'll need to configure a GitHub Access Token for this feature. Details for setting up this feature are provided in a dedicated issue created during initialization.

Sources: .github/initialization/GITHUB_AUTO_ASSIGNMENT.md1-50

Setting Up Firebase Hosting Preview (Optional)

The template includes support for deploying the UI catalog to Firebase Hosting for PR previews. To enable this feature:

  1. Create a new Firebase project
  2. Initialize Firebase Hosting
  3. Configure the GitHub workflow

Sources: .github/initialization/FIREBASE_HOSTING_PREVIEW.md1-112

Setting Up Splash Screen

To set up a splash screen for your app:

  1. Add the flutter_native_splash dependency to your pubspec.yaml
  2. Add splash images to your assets directory
  3. Configure the splash screen
  4. Run the flutter_native_splash tool to generate the necessary files

Sources: .github/initialization/SPLASH_SCREEN.md1-88

App Icon Setup

You'll need to configure app icons for both Android and iOS:

  • For iOS: 1024x1024 icon size
  • For Android: Adaptive icons with foreground and background elements

Sources: .github/initialization/ABOUT_ICON.md1-33

Project Structure Overview

The project follows a monorepo structure:

For more detailed information on the project structure, see Project Structure.

Sources: Architecture diagrams provided in prompt

Running the Application

Understanding Environment Flavors

The project supports three environment flavors:

  • Development (dev)
  • Staging (stg)
  • Production (prd)

Each flavor has its own configuration in the flavor/ directory.

Launch Configurations

The easiest way to run the application is to use the provided launch configurations in your IDE:

VSCode Launch Configurations

ConfigurationPurpose
dev-debugRun the main app with development flavor
stg-debugRun the main app with staging flavor
prd-debugRun the main app with production flavor
ui-catalogRun the UI component catalog

Sources: .vscode/launch.json1-52

Running from Command Line

You can also run the application from the command line:

# Navigate to the app directory
cd apps/app

# Run with development flavor
flutter run --dart-define-from-file=flavor/dev.json

# Run with staging flavor
flutter run --dart-define-from-file=flavor/stg.json

# Run with production flavor
flutter run --dart-define-from-file=flavor/prd.json

To run the UI catalog:

cd apps/catalog
flutter run

Sources: .vscode/launch.json8-43

Next Steps

After completing the initial setup and running the application, you may want to explore: