๐Ÿš€ Creating Apps with Flutter: DAY 1-> Installation



 

Flutter comes bundled with a compatible version of Dart, so in most cases you don’t need to install Dart separately. However, if you do install Dart on its own, make sure Flutter’s version of Dart takes priority in your system PATH, as mismatched versions may cause errors.

This guide covers all operating systems (Windows, macOS, Linux, ChromeOS).


1. System Requirements

General

  • 64-bit operating system

  • Disk space: at least 1.5 GB free (not including IDEs or tools)

  • Internet connection

Tools

  • Git → required for Flutter SDK management

  • Terminal or Shell → Command Prompt / PowerShell (Windows), bash/zsh/fish (Linux/macOS/ChromeOS)

  • Optional IDEs: Android Studio, VS Code, IntelliJ


2. Get the Flutter SDK

Option A: Download Prebuilt SDK (Recommended)

  • Go to the Flutter SDK releases page.

  • Download the latest stable release for your OS:

    • Windows.zip

    • macOS.zip (Intel or Apple Silicon)

    • Linux / ChromeOS.tar.xz

  • Extract it to a permanent location, e.g.:

    C:\src\flutter (Windows) ~/development/flutter (macOS/Linux/ChromeOS)

Option B: Clone from GitHub

If you want to switch channels or versions easily:

git clone https://github.com/flutter/flutter.git -b stable

3. Add Flutter to Your PATH

So you can run flutter from any terminal:

Windows

  1. Search "env" → select Edit environment variables for your account.

  2. Under User variables, find Path.

    • If it exists → append:

      C:\src\flutter\bin
    • If not → create a new Path variable with that value.

  3. Restart your terminal.

macOS / Linux / ChromeOS

Edit your shell config (~/.zshrc, ~/.bashrc, or ~/.bash_profile) and add:

export PATH="$PATH:/path-to-flutter-sdk/bin"

Then reload your shell:

source ~/.zshrc

4. Dart SDK Compatibility

⚠️ Important: Flutter already bundles Dart inside:

<flutter-sdk>/bin/cache/dart-sdk

If you’ve installed Dart separately, ensure Flutter’s Dart comes first in your PATH.

Check paths

Run:

which flutter dart # macOS / Linux / ChromeOS where flutter dart # Windows

✅ Correct → both from the same directory:

.../flutter/bin/flutter .../flutter/bin/dart

❌ Incorrect → different directories (conflict):

.../flutter/bin/flutter /usr/local/bin/dart

๐Ÿ‘‰ Fix: move Flutter’s bin higher in PATH than standalone Dart.


5. Verify Installation

Run:

flutter doctor

This checks your setup and reports missing dependencies (e.g., Android SDK, Xcode, Chrome).

Example output:

[!] Android toolchain - develop for Android devices ✗ Android SDK is missing command line tools

๐Ÿ‘‰ Follow instructions in the report to resolve issues, then run flutter doctor again.


6. Android Setup

To develop for Android:

  1. Install Android Studio

    • Includes Android SDK, platform tools, and emulator.

  2. Connect a Device

    • Enable Developer options & USB debugging on your phone.

    • Connect via USB → run:

      flutter devices
  3. Set up Emulator

    • In Android Studio → AVD Manager → Create Virtual Device

    • Choose system image (x86/x86_64 recommended)

    • Enable hardware acceleration (GLES 2.0)


7. iOS/macOS Setup (macOS only)

  • Install Xcode from the App Store.

  • Run:

    sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch
  • Accept licenses:

    sudo xcodebuild -license

8. Web Setup

  • Enable web support with:

    flutter config --enable-web
  • Verify:

    flutter devices

    You should see Chrome or another browser listed.


9. Create and Run Your First App

flutter create my_app cd my_app flutter run

✅ Summary

  • Install Flutter (bundles Dart)

  • Ensure Flutter’s Dart is first in PATH

  • Run flutter doctor to fix dependencies

  • Set up platform SDKs (Android, iOS, Web, Desktop)

  • Create and run apps ๐Ÿš€



 

Post a Comment

Previous Post Next Post