tutorial

Getting Started with Flutter: Your Journey Begins Here

Learn what Flutter is, why it's revolutionizing mobile development, and how to set up your first Flutter project from scratch.

K
Kyaw Zayar Tun
October 15, 20258 min read
Getting Started with Flutter: Your Journey Begins Here

Getting Started with Flutter: Your Journey Begins Here#

Welcome to the first post in our comprehensive Flutter development series! Whether you're a seasoned developer looking to expand your toolkit or a complete beginner taking your first steps into mobile development, this series will guide you through everything you need to know about Flutter.

What is Flutter?#

Flutter is Google's open-source UI framework for building natively compiled applications for mobile, web, desktop, and embedded devices from a single codebase. Released in 2017 and reaching stable 1.0 in December 2018, Flutter has quickly become one of the most popular frameworks for cross-platform development.

Why Choose Flutter?#

Single Codebase, Multiple Platforms Write your code once and deploy it to iOS, Android, web, Windows, macOS, and Linux. This dramatically reduces development time and maintenance costs.

Fast Development with Hot Reload Flutter's hot reload feature allows you to see changes instantly without losing your app's state. This makes experimentation and UI tweaking incredibly fast.

Beautiful, Native Performance Flutter doesn't rely on web views or platform-specific widgets. Instead, it uses its own rendering engine (Skia) to draw every pixel on the screen, resulting in smooth 60fps (or 120fps) performance.

Rich Widget Library Flutter comes with a comprehensive set of customizable widgets following both Material Design (Android) and Cupertino (iOS) design languages.

Strong Community & Backing With Google's support and a thriving community, Flutter has excellent documentation, packages, and resources available.

Understanding the Flutter Architecture#

Before we dive into installation, let's understand how Flutter works:

The Dart Programming Language#

Flutter uses Dart, a language also developed by Google. If you're familiar with JavaScript, Java, or C#, Dart will feel comfortable. It's:

  • Object-oriented with optional typing
  • Compiled to native code for great performance
  • Designed for UI development with features like async/await
  • Easy to learn with clear syntax

Everything is a Widget#

In Flutter, everything you see on screen is a widget. Your app is a tree of widgets. Understanding this concept is crucial:

  • StatelessWidget: Immutable widgets that don't change over time
  • StatefulWidget: Widgets that maintain mutable state that can change

The Rendering Pipeline#

Flutter's architecture consists of three layers:

  1. Framework (Dart): Widgets, rendering, animation
  2. Engine (C++): Skia graphics, text layout, Dart runtime
  3. Embedder (Platform-specific): Native platform integration

Setting Up Your Development Environment#

Let's get Flutter installed on your machine. I'll cover all major operating systems.

System Requirements#

Windows:

  • Windows 10 or later (64-bit)
  • Disk Space: 1.64 GB (does not include disk space for IDE/tools)
  • Git for Windows

macOS:

  • macOS 10.14 (Mojave) or later
  • Disk Space: 2.8 GB
  • Xcode for iOS development

Linux:

  • 64-bit distribution
  • Disk Space: 600 MB
  • Various development tools (bash, curl, git, etc.)

Step 1: Download Flutter SDK#

  1. Visit the official Flutter website: flutter.dev
  2. Navigate to "Get Started" and select your operating system
  3. Download the Flutter SDK zip file
  4. Extract it to a desired location (avoid directories requiring elevated privileges)

Recommended locations:

  • Windows: C:\src\flutter
  • macOS/Linux: ~/development/flutter

Step 2: Update Your PATH#

Add Flutter to your system PATH so you can run Flutter commands from any terminal.

Windows:

setx PATH "%PATH%;C:\src\flutter\bin"

macOS/Linux: Add this line to your .bashrc, .zshrc, or .bash_profile:

export PATH="$PATH:$HOME/development/flutter/bin"

Then reload your terminal or run:

source ~/.bashrc  # or ~/.zshrc

Step 3: Run Flutter Doctor#

Open a terminal and run:

flutter doctor

This command checks your environment and displays a report of the status of your Flutter installation. It will show you what's missing and what you need to install.

Example output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.0, on macOS 14.0)
[✗] Android toolchain - develop for Android devices
    ✗ Android SDK not found
[✗] Xcode - develop for iOS and macOS
    ✗ Xcode not installed
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.85.0)

Don't worry if you see some red X marks! We'll fix those next.

Step 4: Install Android Studio (for Android development)#

  1. Download Android Studio

  2. Install Android Studio and follow the setup wizard

  3. Install the following:

    • Android SDK
    • Android SDK Command-line Tools
    • Android SDK Build-Tools
    • Android SDK Platform-Tools
    • Android Emulator
  4. Install Flutter and Dart plugins:

    • Open Android Studio
    • Go to Preferences/Settings → Plugins
    • Search for "Flutter" and install
    • This will also install the Dart plugin

Step 5: Install Xcode (macOS only, for iOS development)#

  1. Install Xcode from the Mac App Store
  2. Configure Xcode command-line tools:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
  1. Accept the Xcode license:
sudo xcodebuild -license accept
  1. Install CocoaPods (iOS dependency manager):
sudo gem install cocoapods

Step 6: Set Up an Editor#

While you can use any text editor, I recommend one of these:

VS Code (Recommended for beginners):

  1. Download from code.visualstudio.com
  2. Install Flutter extension
  3. Install Dart extension

Android Studio: Already set up if you followed Step 4!

Step 7: Verify Installation#

Run flutter doctor again:

flutter doctor

You should now see green checkmarks for the platforms you want to develop for!

Creating Your First Flutter Project#

Now for the exciting part - creating your first Flutter app!

Using Command Line#

flutter create my_first_app
cd my_first_app

This creates a new Flutter project with:

  • lib/main.dart - Your app's entry point
  • pubspec.yaml - Dependency management
  • android/ - Android-specific code
  • ios/ - iOS-specific code
  • test/ - Test files

Using VS Code#

  1. Open Command Palette (Cmd+Shift+P or Ctrl+Shift+P)
  2. Type "Flutter: New Project"
  3. Select "Application"
  4. Choose a location and name your project

Using Android Studio#

  1. File → New → New Flutter Project
  2. Select "Flutter Application"
  3. Choose SDK path and project location
  4. Click Finish

Understanding the Project Structure#

Let's explore what Flutter created for us:

my_first_app/
├── android/          # Android-specific files
├── ios/              # iOS-specific files
├── lib/              # Your Dart code lives here!
│   └── main.dart     # App entry point
├── test/             # Test files
├── pubspec.yaml      # Dependencies and assets
└── README.md

The pubspec.yaml File#

This is your project's configuration file:

name: my_first_app
description: A new Flutter project.
 
dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
 
dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0
 
flutter:
  uses-material-design: true

Here you'll add external packages, define assets (images, fonts), and configure your app.

Running Your First App#

Using an Emulator/Simulator#

Android:

  1. Open Android Studio
  2. Tools → Device Manager
  3. Create a new virtual device
  4. Select a device definition and system image
  5. Launch the emulator

iOS (macOS only):

  1. Open Simulator from Xcode or run:
open -a Simulator

Using a Physical Device#

Android:

  1. Enable Developer Options on your device
  2. Enable USB Debugging
  3. Connect via USB
  4. Run flutter devices to verify

iOS:

  1. Connect your iPhone/iPad
  2. Trust the computer on your device
  3. Set up development team in Xcode

Launch Your App#

flutter run

Or use the play button in your IDE!

You should see a counter app with a floating action button. Click it to increment the counter. Congratulations! 🎉

Exploring Hot Reload#

Make a change in main.dart:

  1. Find the primarySwatch property
  2. Change Colors.blue to Colors.red
  3. Press r in the terminal or click the hot reload button
  4. Watch your app update instantly!

This is one of Flutter's killer features. You can iterate on your UI incredibly fast.

Understanding main.dart#

Let's look at the generated code:

import 'package:flutter/material.dart';
 
void main() {
  runApp(const MyApp());
}
 
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

Key points:

  • main() is the entry point
  • runApp() inflates the widget tree
  • MaterialApp is the root widget for Material Design apps
  • build() method describes how to display the widget

Common Issues and Solutions#

Issue: "Doctor" shows Android license not accepted#

Solution:

flutter doctor --android-licenses

Accept all licenses.

Issue: Cannot find Flutter SDK#

Solution: Verify your PATH is set correctly. Restart your terminal after modifying PATH.

Issue: Gradle build fails#

Solution: Check your internet connection. Gradle needs to download dependencies on first build.

Issue: iOS build fails with CocoaPods error#

Solution:

cd ios
pod install
cd ..
flutter clean
flutter run

Next Steps#

Congratulations! You now have Flutter installed and have run your first app. In the next post, we'll dive into:

  • Dart fundamentals for Flutter development
  • Understanding widgets in depth
  • Building your first custom UI
  • State management basics

Useful Resources#

Challenge#

Before the next post, try these exercises:

  1. Change the theme colors of your app
  2. Modify the counter increment from +1 to +5
  3. Change the app title and button text
  4. Add a second button that decrements the counter

Feel free to experiment and break things - that's how we learn!


Happy coding! 🚀

Share this article:
K

About Kyaw Zayar Tun

Passionate mobile developer specializing in Flutter and Android development.