System Requirements
- Operating System: Windows, macOS, or Linux.
- Disk Space: ~2 GB (not including space for IDEs).
- Tools: Git must be installed on your system.
Installation Steps
Windows
>Download Flutter SDK:- Go to the Flutter website.
- Download the latest flutter_windows_<version>-stable.zip.
- Extract the file to a directory, e.g., C:\src\flutter.
- Open System Properties.
- Go to Environment Variables and edit the "Path".
- Add C:\src\flutter\bin.
- If Git is not installed, download it from Git SCM.
- Open a terminal and run flutter doctor.
macOS
-
Download Flutter SDK:
- Go to the Flutter website.
- Download the latest flutter_macos_<version>-stable.zip.
-
Extract the ZIP File:
- Extract it to a directory, e.g.,~/development/flutter.
-
Update Path:
- Open or create the ~/.zshrc or ~/.bash_profile file.
- Add this line:
export PATH="$PATH:`pwd`/flutter/bin"
- Save the file and run:
source ~/.zshrc
Install Flutter SDK on Linux
-
Download Flutter SDK:
Go to the >Flutter website and download the latest flutter_linux_<version>-stable.tar.xz.
-
Extract the Tar File:
Run the following command in your terminal:
Move it to a desired location, e.g., ~/development/flutter.
-
Update Path:
Open or create the ~/.bashrc or ~/.zshrc file and add this line:
export PATH="$PATH:`pwd`/flutter/bin"
Save the file and run:
source ~/.bashrc
-
Install Required Packages:
Run the following command to install necessary dependencies:
sudo apt-get install curl git unzip xz-utils libglu1-mesa
-
Run Flutter Doctor:
Verify your setup by running:
flutter doctor
Set Up an IDE for Flutter Development
-
Install an Editor for Flutter Development:
-
Android Studio:
- Install Android Studio from its official website: Download Android Studio.
- Open Android Studio, go to File → Settings → Plugins.
- Search for and install the Flutter and Dart plugins.
-
VS Code:
- Install Visual Studio Code from its official website: Download VS Code.
- Open VS Code and navigate to the Extensions Marketplace.
- Search for and install the Flutter and Dart extensions.
-
Android Studio:
Flutter Setup Instructions
1. Install Flutter and Dart Plugins
- Open Android Studio.
- Navigate to File → Settings → Plugins (on macOS: Android Studio → Preferences → Plugins).
- Search for Flutter in the plugin marketplace and click Install.
- It will prompt to install the Dart plugin as well. Confirm and install it.
- Restart Android Studio.
2. Create a New Flutter Project
- Open Android Studio.
- Click on File → New → New Flutter Project.
-
In the "New Flutter Project" window:
- Project Type: Select Flutter Application.
- Flutter SDK Path: Provide the path where Flutter SDK is installed.
- Project Name: Enter your project name (e.g., simple_app).
- Project Location: Choose your desired directory.
- Click Finish to create the project.
- Open Android Studio.
- Click on File → New → New Flutter Project.
-
In the "New Flutter Project" window:
- Project Type: Select Flutter Application.
- Flutter SDK Path: Provide the path where Flutter SDK is installed.
- Project Name: Enter your project name (e.g., simple_app).
- Project Location: Choose your desired directory.
- Click Finish to create the project.
- Replace the default code in lib/main.dart with the following code:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Simple Flutter App',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final screenHeight = MediaQuery.of(context).size.height;
return Scaffold(
appBar: AppBar(
title: Text('Simple Flutter App'),
centerTitle: true,
),
body: Center(
child: Text(
'Hello, Flutter!',
style: TextStyle(
fontSize: screenWidth * 0.06,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
print('Button Pressed!');
},
child: Icon(Icons.add),
),
);
}
}
- Save the file and run the project using flutter run or the run button in Android Studio.
- When the app runs, you will see the text "Hello, Flutter!" displayed in the center of the screen with a floating action button below.