Start your journey with flutter here! Step by step to install Flutter
Futter, a popular technology in mobile development. The ease of implementation makes this technology quickly popular and used in many applications. But if you are new in flutter, how the first step do using it? This is step by step to install Flutter and start your first application.
Prerequisites and Dependencies
Before starting, ensure you have the following:
General Requirements
Operating System:
Windows: Windows 10 or later (64-bit).
macOS: macOS 10.14 (Mojave) or later.
Disk Space: At least 2.8 GB of free disk space for the Flutter SDK.
RAM: Minimum 4 GB (8 GB recommended for better performance).
Dependencies
Git:
Install Git to manage Flutter projects.
Download Git.
Java Development Kit (JDK) (for Android Development):
Required for building Android apps.
Download JDK.
Visual Studio Code:
Install Visual Studio Code as the preferred code editor.
Download Visual Studio Code.
Flutter Extensions for VS Code:
Install the Flutter and Dart extensions in Visual Studio Code for Flutter development.
Command-Line Tools:
Command Prompt or PowerShell (Windows) or Terminal (macOS).
Additional Tools:
Android Studio and Xcode (specific to your OS).
1. Setting up Flutter
Step 1: Download Flutter SDK
1. Go to the official Flutter website.
2. Navigate to the “Get started” section and select your operating system (Windows or macOS).
3. Download the Flutter SDK zip file.
4. Extract the zip file to a suitable location:
Windows: C:\flutter
macOS: ~/Documents/flutter
Step 2: Update Environment Variables
On Windows:
1. Open the Start menu and search for “Environment Variables.”
2. Click on “Edit the system environment variables.”
3. Under the “System Properties” dialog, go to the “Advanced” tab and click “Environment Variables.”
4. In the “System variables” section, find the Path variable and click “Edit.”
5. Add the path to the Flutter bin folder (e.g., C:\flutter\bin).
On macOS:
1. Open the Terminal.
2. Add Flutter to your PATH by editing your shell configuration file (.zshrc, .bash_profile, or .bashrc),
3. Reload the configuration file.
export PATH=”$PATH:`pwd`/flutter/bin”
source ~/.zshrc
Step 3: Install Required Tools
Android Studio:
1. Download and install Android Studio.
2. Open Android Studio, go to “Settings,” and install the necessary SDK tools (e.g., Android SDK, Android SDK Platform-Tools, and Android Emulator).
Xcode (macOS only):
1. Install Xcode from the Mac App Store.
2. Open Xcode and agree to the license agreement.
3. Install the Xcode command-line tools:
xcode-select –install
Step 4: Set up a Simulator
On Windows:
1. In Android Studio, open the AVD Manager (Tools > Device Manager).
2. Click “Create Virtual Device” and select a hardware profile (e.g., Pixel 5).
3. Select a system image (e.g., Android 12) and click “Next.”
4. Configure the emulator settings as needed and click “Finish.”
5. Launch the emulator by clicking the green play button in the AVD Manager.
On macOS:
1. Open Xcode and go to “Preferences” > “Components.”
2. Install a simulator for the latest iOS version (e.g., iPhone 14).
3. Open the iOS simulator by running the following command and rnsure the simulator is running before proceeding.:
open -a Simulator
Step 5: Install VS Code Extensions
1. Open Visual Studio Code.
2. Go to the Extensions view by clicking on the Extensions icon in the Activity Bar or pressing Ctrl+Shift+X(Windows) or Cmd+Shift+X (macOS).
3. Search for “Flutter” and install the Flutter extension. The Dart extension will be installed automatically
Step 6: Verify Installation
1. Open a terminal (Command Prompt or PowerShell on Windows, Terminal on macOS).
2. Run the following command, this will check your environment and provide suggestions to fix any issues.
flutter doctor
Step 7: Create and Open a Flutter Project
1. Open a terminal in Visual Studio Code.
2. Run the following command:
flutter create hello_world
3. Navigate to the project directory:
cd hello_world
4. Open the project in Visual Studio Code:
code .
Step 8: Sync Dependencies
1. Ensure all required dependencies are downloaded by running:
flutter pub get
2. On macOS, for iOS projects, navigate to the ios folder and run:
cd ios
pod install
This will install all required CocoaPods dependencies.
3. Return to the root project directory:
cd ..
Step 9: Run the App
Connect an Android device or start the Android emulator (Windows) / iOS simulator (macOS).
Press F5 in Visual Studio Code to start debugging and run the app.
2. The “Hello World” Code
Once your project is set up, you can customize the default Flutter app to display “Hello, World!” by editing the lib/main.dart file:
import ‘package:flutter/material.dart’;
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text(‘Hello World App’),
),
body: const Center(
child: Text(
‘Hello, World!’,
style: TextStyle(fontSize: 24),
),
),
),
);
}
}
Save the file and press F5 in Visual Studio Code to run the app. You should see “Hello, World!” displayed on the screen.
Closing
These are step by step to install Flutter for the first time. For learning from official website about how the step to install Flutter, you can go here https://flutter.dev
For understanding about the basic of state management in Flutter, follow this https://programmermumet.fly.dev/2024/12/28/learning-flutter-you-must-understand-these/