πŸš›Setup & Installation

Flutter is rapidly becoming the go-to solution for developers aiming to create cross-platform applications. If you're looking to dive into the world of Flutter, this guide will walk you through the installation process for macOS, Windows, and Linux.

Installing Flutter on macOS

  1. Download the Flutter SDK for macOS

    • Navigate to the official Flutter website to secure the latest Flutter macOS zip file.

    • Once downloaded, extract and position the flutter folder in your preferred directory, such as ~/development.

  2. Incorporate Flutter into your System Path

    • To seamlessly run Flutter commands, integrate the flutter/bin directory into your system path. Open your terminal and input export PATH="$PATH:pwd/flutter/bin".

  3. Initiate a System Check with Flutter Doctor

    • Launch your terminal and execute flutter doctor to ensure Flutter's successful integration.


Running Your First Flutter App on an Emulator

After successfully installing Flutter, the next step is to set up an IDE and run your Flutter app on an emulator.

Setting Up an IDE

Flutter supports a range of IDEs, but for this tutorial, we'll focus on Visual Studio Code and Android Studio, as they are the most popular and beginner-friendly.

1. Visual Studio Code (VS Code)

  • Installation

    • Download and install Visual Studio Code.

    • Open VS Code and head to the Extensions view by clicking on the square icon on the sidebar or pressing Ctrl+Shift+X.

    • Search for "Flutter" and install the Flutter extension provided by Dart Code.

2. Android Studio

  • Installation

    • Download and install Android Studio.

    • During installation, ensure the "Android Virtual Device" option is checked.

    • Once installed, open Android Studio and head to Configure > Plugins.

    • Search for "Flutter" and install the Flutter plugin. This will also prompt you to install the Dart plugin, which is necessary for Flutter development.

Setting Up an Emulator

1. Using Android Studio

  • Creating a Virtual Device

    • Open Android Studio and navigate to Tools > AVD Manager.

    • Click on "Create Virtual Device" and select a hardware profile for your emulator.

    • Choose a system image (preferably with Google APIs) and download it.

    • Finish the setup and click on "Play" to start your emulator.

2. Using VS Code

  • If you've set up an emulator using Android Studio, VS Code can directly use that. Ensure the emulator is running when you try to launch your Flutter app from VS Code.

Running Your First Flutter App

  1. Create a New Flutter App

    • In Android Studio: File > New Flutter Project > Flutter Application.

    • In VS Code: Open the command palette (Ctrl+Shift+P), and run Flutter: New Project.

  2. Run the App

    • In Android Studio: Click on the green play button.

    • In VS Code: With the main Dart file open (main.dart), click on Run > Start Debugging.

Your Flutter app should now launch on the emulator. You'll see a default app with a clickable "+" button that increments a counter.


Final Thoughts

With Flutter and your chosen IDE set up, you're now equipped to start building beautiful cross-platform apps. As you progress, remember that the official Flutter documentation is a treasure trove of information.

Happy coding!

Last updated