 to understand widgets, layouts, and Dart fundamentals.
### Windows Development Requirements
To build Flutter applications for Windows, you need:
- Windows 10 or later (64-bit).
- Flutter SDK.
- Visual Studio 2022.
- Desktop development with C++ workload.
- Windows SDK.
- Visual Studio Code or Android Studio (optional).
**Important:** Visual Studio and Visual Studio Code are different applications. Installing Visual Studio Code alone does not provide the C++ build tools required for Windows desktop builds.
### macOS Development Requirements
For macOS desktop development, you need:
- A Mac computer.
- Flutter SDK.
- Xcode.
- Xcode command-line tools.
- CocoaPods where required by your project dependencies.
### Linux Development Requirements
For Linux desktop development, you generally need:
- A supported Linux distribution.
- Flutter SDK.
- Clang.
- CMake.
- Ninja.
- GTK development libraries.
- pkg-config.
The exact system packages can vary depending on your Linux distribution and Flutter dependencies.
## Step 1: Check Your Flutter Installation
First, open your terminal or command prompt and check whether Flutter is installed.
Run:
```bash
flutter --version
```
This command displays your installed Flutter version.
Next, run:
```bash
flutter doctor
```
Flutter Doctor checks your development environment and identifies missing dependencies.
If you are developing Windows applications, pay particular attention to the Visual Studio section. For macOS, check Xcode, and for Linux, check the required development libraries.
Resolve the relevant issues before proceeding.
## Step 2: Enable Flutter Desktop Support
Flutter desktop support is available through the Flutter SDK.
You can check the available desktop devices by running:
```bash
flutter devices
```
To enable Windows desktop support, run:
```bash
flutter config --enable-windows-desktop
```
For macOS:
```bash
flutter config --enable-macos-desktop
```
For Linux:
```bash
flutter config --enable-linux-desktop
```
You only need to enable the platform you intend to develop for.
After enabling support, check the available devices again:
```bash
flutter devices
```
Your desktop device should appear when the required development tools are installed and configured correctly.
## Step 3: Create Your First Flutter Desktop Project
Now let's create a new Flutter project.
Open the terminal and run:
```bash
flutter create my_desktop_app
```
Move into the project directory:
```bash
cd my_desktop_app
```
Flutter creates the standard project structure, including the `lib` directory and platform-specific folders.
A simplified project structure looks like this:
```text
my_desktop_app/
│
├── android/
├── ios/
├── lib/
│ └── main.dart
├── linux/
├── macos/
├── test/
├── web/
├── windows/
├── pubspec.yaml
└── README.md
```
The `windows`, `macos`, and `linux` directories contain the native runner projects for their respective platforms.
The `lib` directory contains your main Dart and Flutter application code.
You can reuse the same `lib` code across supported platforms, although some platform-specific features may require additional configuration.
## Step 4: Create a Simple Desktop Application
Let's replace the default Flutter application with a simple desktop dashboard.
Open:
```text
lib/main.dart
```
Replace its contents with the following code:
```dart
import 'package:flutter/material.dart';
void main() {
runApp(const DesktopApp());
}
class DesktopApp extends StatelessWidget {
const DesktopApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'My Desktop App',
theme: ThemeData(
colorSchemeSeed: Colors.blue,
useMaterial3: true,
),
home: const DashboardScreen(),
);
}
}
class DashboardScreen extends StatelessWidget {
const DashboardScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Desktop Dashboard'),
),
body: Row(
children: [
Container(
width: 220,
color: Colors.blue.shade50,
child: Column(
children: [
const SizedBox(height: 30),
const Text(
'My Application',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 30),
ListTile(
leading: const Icon(Icons.dashboard),
title: const Text('Dashboard'),
onTap: () {},
),
ListTile(
leading: const Icon(Icons.settings),
title: const Text('Settings'),
onTap: () {},
),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Welcome to Desktop App',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 20),
Wrap(
spacing: 16,
runSpacing: 16,
children: [
dashboardCard(
'Total Users',
'1,250',
Icons.people,
),
dashboardCard(
'Total Orders',
'450',
Icons.shopping_cart,
),
dashboardCard(
'Revenue',
'\$8,500',
Icons.attach_money,
),
],
),
],
),
),
),
],
),
);
}
}
Widget dashboardCard(
String title,
String value,
IconData icon,
) {
return SizedBox(
width: 220,
child: Card(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(icon, size: 30, color: Colors.blue),
const SizedBox(height: 12),
Text(title),
const SizedBox(height: 8),
Text(
value,
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
);
}
```
This example creates a basic desktop dashboard with:
- A navigation sidebar.
- A dashboard heading.
- Three information cards.
- A desktop-friendly horizontal layout.
- Material Design styling.
You can expand this example by adding authentication, database connectivity, charts, reports, and other application features.
## Step 5: Run Your Flutter Desktop Application
Once your code is ready, you can run the application directly on your desktop.
For Windows:
```bash
flutter run -d windows
```
For macOS:
```bash
flutter run -d macos
```
For Linux:
```bash
flutter run -d linux
```
Flutter will compile the project and launch the desktop application.
If you are using Visual Studio Code, you can also select the desktop device from the device selector and press F5 to start debugging.
**Tip:** Make sure the required desktop development tools are installed before running these commands.
## Step 6: Build a Flutter Desktop Application for Windows
Running an application in development mode is different from creating a release build.
To generate a Windows release build, execute:
```bash
flutter build windows
```
After the build completes, Flutter generates the application files inside:
```text
build/windows/x64/runner/Release/
```
The output contains your application executable along with the required runtime files and libraries.
For example:
```text
Release/
│
├── my_desktop_app.exe
├── flutter_windows.dll
├── data/
└── other required files
```
The executable depends on the supporting files generated with it. Therefore, do not distribute only the `.exe` file.
### How to Share Your Windows Desktop Application
You can distribute the complete release output directory.
For a better installation experience, you can package your application using an installer creation tool such as Inno Setup or another Windows installer solution.
An installer can help users:
- Install the application in a selected directory.
- Create desktop shortcuts.
- Add Start Menu shortcuts.
- Uninstall the application.
- Manage application files more conveniently.
You should also test the packaged application on a clean Windows machine before distributing it.
## Step 7: Build Flutter Desktop Applications for macOS
If you are using macOS, you can generate a release build with:
```bash
flutter build macos
```
Flutter generates the macOS application bundle inside:
```text
build/macos/Build/Products/Release/
```
You will find an application bundle with the `.app` extension.
For example:
```text
MyDesktopApp.app
```
You can test this application on your Mac.
For public distribution, you may also need to configure application signing, notarization, and packaging according to Apple's distribution requirements.
## Step 8: Build Flutter Desktop Applications for Linux
To generate a Linux desktop release build, execute:
```bash
flutter build linux
```
The generated application files are available inside:
```text
build/linux/x64/release/bundle/
```
This directory contains the executable and its required supporting files.
You can distribute the bundle or package it using a suitable Linux distribution format, depending on your target users.
Common distribution options include:
- Debian packages (`.deb`).
- RPM packages.
- AppImage.
- Snap packages.
- Flatpak.
The correct packaging approach depends on your target Linux distributions and their requirements.
## Step 9: Create a Responsive Desktop UI
Desktop applications have different screen sizes and interaction patterns compared with mobile applications.
A layout designed only for a mobile screen may not look good when opened in a large desktop window.
For better Flutter desktop UI development, consider using:
### 1. LayoutBuilder
LayoutBuilder allows you to build layouts according to the available space.
Example:
```dart
LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 700) {
return const Text('Compact Layout');
}
return const Text('Desktop Layout');
},
)
```
You can use this approach to switch between compact and expanded layouts.
### 2. Expanded and Flexible
Use Expanded and Flexible to distribute available space between widgets.
```dart
Row(
children: [
Expanded(
flex: 2,
child: Container(color: Colors.blue),
),
Expanded(
flex: 5,
child: Container(color: Colors.green),
),
],
)
```
This is particularly useful for dashboards, navigation layouts, and multi-column interfaces.
### 3. SingleChildScrollView
Desktop windows can be resized, so content should remain accessible even when the available space becomes smaller.
```dart
SingleChildScrollView(
child: Column(
children: const [
Text('Dashboard'),
Text('Reports'),
Text('Settings'),
],
),
)
```
For longer lists, consider using ListView.builder instead of creating every list item at once.
You can read our [Flutter ListView.builder tutorial](https://fluttertpoints.com/) to understand efficient list rendering.
### 4. NavigationRail
NavigationRail is useful for desktop applications that need a vertical navigation menu.
```dart
NavigationRail(
selectedIndex: 0,
onDestinationSelected: (index) {},
destinations: const [
NavigationRailDestination(
icon: Icon(Icons.dashboard),
label: Text('Dashboard'),
),
NavigationRailDestination(
icon: Icon(Icons.settings),
label: Text('Settings'),
),
],
)
```
It provides a more desktop-friendly navigation experience than a typical mobile bottom navigation bar.
## Step 10: Add Desktop Features to Your Flutter Application
A desktop application often needs features that are less common in mobile applications.
Here are some useful capabilities you can add.
### 1. Keyboard Shortcuts
Desktop users expect keyboard shortcuts for common operations.
Flutter provides the `Shortcuts`, `Actions`, and `Intent` widgets for implementing keyboard shortcuts.
For example, you can define a shortcut for a custom action using:
```dart
Shortcuts(
shortcuts: {
LogicalKeySet(
LogicalKeyboardKey.control,
LogicalKeyboardKey.keyS,
): const SaveIntent(),
},
child: Actions(
actions: {
SaveIntent: CallbackAction<SaveIntent>(
onInvoke: (intent) {
debugPrint('Save action triggered');
return null;
},
),
},
child: const Focus(
autofocus: true,
child: Text('Press Ctrl + S to save'),
),
),
)
```
For a complete implementation, define the `SaveIntent` class and ensure the widget has the appropriate focus behavior.
On macOS, you may also want to support Command-based shortcuts.
### 2. File and Folder Selection
Desktop applications commonly allow users to select files and folders.
You can use the `file_picker` package to provide file selection functionality.
Add the package:
```bash
flutter pub add file_picker
```
Example:
```dart
import 'package:file_picker/file_picker.dart';
Future<void> selectFile() async {
final result = await FilePicker.platform.pickFiles();
if (result != null) {
final file = result.files.single;
debugPrint('Selected file: ${file.name}');
debugPrint('File path: ${file.path}');
}
}
```
The selected file path may not be available in every platform or configuration, so handle null values appropriately.
### 3. Window Management
You may want to control the desktop application's window size, minimum dimensions, or title.
Packages such as `window_manager` can help implement window management features.
Add the package:
```bash
flutter pub add window_manager
```
You can use it to configure window properties, such as minimum size and title, after initializing the package.
Always check the package documentation for the initialization and platform-specific requirements of the version you install.
### 4. Local Database
Many desktop applications need to store information locally.
You can use SQLite through packages such as `sqflite_common_ffi` for supported desktop environments.
Local databases are useful for:
- Inventory applications.
- Billing software.
- Offline management systems.
- Employee records.
- Personal productivity tools.
Choose a database according to your application's storage, security, and synchronization requirements.
## Step 11: Add State Management to Your Desktop Application
As your desktop application grows, managing application state becomes important.
For small applications, Flutter's built-in `setState()` may be sufficient.
For larger projects, you can use state management solutions such as:
- Provider.
- Riverpod.
- Bloc.
- GetX.
For example, Riverpod can help organize application state and separate business logic from the user interface.
If you want to learn more, read our [Flutter Riverpod tutorial](https://fluttertpoints.com/flutter-riverpod-tutorial).
A good architecture makes it easier to maintain features such as authentication, settings, reports, database operations, and API integration.
## Step 12: Connect Your Flutter Desktop App to an API
Desktop applications can communicate with backend services just like mobile applications.
You can use the `http` or `dio` package to make API requests.
For example, install Dio:
```bash
flutter pub add dio
```
Create an API service:
```dart
import 'package:dio/dio.dart';
class ApiService {
final Dio dio = Dio();
Future<void> fetchUsers() async {
try {
final response = await dio.get(
'https://jsonplaceholder.typicode.com/users',
);
print(response.data);
} catch (e) {
print('API Error: $e');
}
}
}
```
You can call this service from your dashboard or another screen.
Remember to handle loading states, network failures, authentication, and API timeouts properly.
For more information, explore our [Flutter Dio API Call tutorial](https://fluttertpoints.com/flutter-dio-api-call).
## Step 13: Test and Debug Your Flutter Desktop Application
Testing is an important part of desktop application development.
You should test your application on the target operating system and verify that the interface works correctly at different window sizes.
Some useful commands include:
**Run static analysis:**
```bash
flutter analyze
```
**Run unit and widget tests:**
```bash
flutter test
```
**Check available devices:**
```bash
flutter devices
```
**Run the application in debug mode:**
```bash
flutter run -d windows
```
You can also use Flutter DevTools to inspect widgets, analyze performance, and debug application behavior.
For more practical debugging techniques, read our [Flutter Debugging guide](https://fluttertpoints.com/flutter-debugging).
## Common Problems in Flutter Desktop Development
While developing desktop applications, you may encounter some common errors.
Here are a few problems and their possible solutions.
| Problem | Possible Solution |
|---|---|
| Windows desktop device not detected | Enable Windows desktop support and check Visual Studio installation |
| Visual Studio toolchain error | Install the Desktop development with C++ workload |
| CMake not found on Linux | Install CMake and required build dependencies |
| Missing GTK libraries | Install the GTK development packages required by Flutter |
| macOS build fails | Check Xcode installation and command-line tools |
| Application crashes on another PC | Include the complete release bundle and required dependencies |
| Plugin not supported on desktop | Check whether the package supports your target platform |
| UI looks incorrect on large screens | Use responsive layouts and desktop-friendly navigation |
### Error: No Windows Desktop Device Available
If Flutter does not detect a Windows desktop device, run:
```bash
flutter config --enable-windows-desktop
flutter doctor
flutter devices
```
Also verify that Visual Studio and its required C++ components are installed.
### Error: CMake or Linux Dependencies Missing
On Linux, Flutter desktop builds require additional system development tools.
Check the Flutter Doctor output and install the missing dependencies for your distribution.
### Error: A Flutter Package Does Not Support Desktop
Not every Flutter package supports Windows, macOS, or Linux.
Before adding a package, check its platform support on pub.dev.
If a package does not support your target platform, look for a desktop-compatible alternative or implement the required functionality using platform-specific code.
## Best Practices for Flutter Desktop App Development
Follow these practices to build reliable and maintainable desktop applications.
1. **Design for larger screens:** Use sidebars, navigation rails, tables, and multi-column layouts where appropriate.
2. **Support window resizing:** Make sure your application works at different window dimensions.
3. **Use keyboard shortcuts:** Add shortcuts for frequently used desktop operations.
4. **Handle mouse interactions:** Support hover states, right-click menus, and mouse-based navigation where useful.
5. **Choose desktop-compatible packages:** Always verify package support for Windows, macOS, and Linux.
6. **Separate business logic:** Keep application logic outside UI widgets where practical.
7. **Optimize performance:** Avoid unnecessary widget rebuilds and expensive operations on the main isolate.
8. **Test release builds:** Debug builds are not a replacement for testing the actual release application.
9. **Secure sensitive data:** Do not hardcode API keys, passwords, or other secrets in your application.
10. **Package the complete application:** Include all required runtime files when distributing your software.
## Flutter Desktop vs Flutter Mobile Development
Although Flutter uses the same framework for desktop and mobile development, there are some important differences.
| Feature | Mobile App | Desktop App |
|---|---|---|
| Primary input | Touch | Mouse and keyboard |
| Screen size | Usually smaller | Usually larger |
| Navigation | Bottom navigation, drawers | Sidebars, menus, navigation rail |
| Window resizing | Usually not applicable | Important |
| File access | Platform-specific permissions | Desktop file selection |
| Keyboard shortcuts | Less common | Frequently used |
| Distribution | App stores or APK | Installers or platform packages |
| Layout | Mobile responsive UI | Desktop-oriented responsive UI |
You can share much of your Flutter application code across platforms, but the user interface should be designed according to the platform.
## Frequently Asked Questions (FAQs)
### 1. Can I create a Windows desktop application using Flutter?
Yes. Flutter officially supports Windows desktop development. You can create a Flutter project, enable Windows desktop support, and generate a release build using `flutter build windows`.
### 2. Can Flutter create desktop applications for macOS and Linux?
Yes. Flutter supports macOS and Linux desktop applications. You need the appropriate development tools for each operating system to build and test your application.
### 3. Can I use the same Flutter code for mobile and desktop applications?
Yes. You can share common Dart code, business logic, API services, and many UI components across platforms. However, some features and layouts may need platform-specific implementations.
### 4. How do I generate an EXE file using Flutter?
Run the following command on a configured Windows development machine:
```bash
flutter build windows
```
The generated executable is located in the Windows release output directory under `build/windows/x64/runner/Release/`. Distribute the complete output folder rather than only the executable.
### 5. Do I need Visual Studio for Flutter Windows development?
Yes, you need the Visual Studio C++ build tools for Windows desktop development. Install Visual Studio with the Desktop development with C++ workload. Visual Studio Code alone is not sufficient.
### 6. Is Flutter good for desktop application development?
Flutter is a good option for many cross-platform desktop applications, especially when you want to share code between mobile and desktop platforms. It is suitable for dashboards, business tools, productivity applications, and other custom interfaces.
### 7. Can I use Firebase in a Flutter desktop application?
Firebase functionality depends on the specific Firebase product and its supported platforms. Check the official FlutterFire documentation and the compatibility of individual packages before choosing your architecture.
### 8. Can I publish a Flutter desktop application?
Yes. You can distribute desktop applications through your own website, company infrastructure, or supported application distribution platforms. You should configure platform-specific signing, packaging, and security requirements before public distribution.
### 9. Is Flutter desktop development free?
Flutter is an open-source framework and can be used without paying a framework license fee. However, operating system requirements, developer accounts, code-signing certificates, hosting, and other distribution services may involve costs.
### 10. Can I convert an existing Flutter mobile app into a desktop application?
Yes. You can add desktop platform support to an existing Flutter project and adapt its interface for larger screens. However, you should verify that all dependencies and plugins support the desktop platforms you want to target.
## Conclusion
Flutter Desktop App Development makes it possible to create applications for Windows, macOS, and Linux using Flutter and Dart.
You can start with a simple Flutter project, enable desktop support, build a desktop-friendly interface, and generate release applications using platform-specific build commands.
The biggest advantage is code reuse. Developers who already work with Flutter can use their existing skills to build desktop applications without learning an entirely different UI framework.
Start with a small project, experiment with desktop layouts, add features such as file selection and keyboard shortcuts, and gradually build a complete desktop application.
Flutter Desktop App Development](https://fluttertpoints.com/wp-content/uploads/2026/11/Flutter-Desktop-App-Development-1024x576.png)
Flutter is widely known for building Android and iOS applications, but it can also be used to develop desktop applications for Windows, macOS, and Linux. This means developers can use a single Flutter codebase to create applications for multiple platforms without building completely separate projects.
With Flutter desktop support, you can create productivity tools, business applications, management systems, media players, dashboards, and many other types of desktop software using Dart and Flutter widgets.
In this tutorial, you will learn Flutter Desktop App Development from the beginning. We will configure Flutter for desktop development, create a desktop project, run it on Windows, build a release application, and explore important desktop-specific features.
What Is Flutter Desktop App Development?
Flutter Desktop App Development is the process of creating desktop applications using the Flutter framework and Dart programming language.
Flutter provides desktop support through native application runners for Windows, macOS, and Linux. You can use familiar Flutter widgets, state management solutions, packages, and application architecture to build desktop software.
For example, if you already know how to create a Flutter mobile application, you can reuse much of that knowledge when developing desktop applications.
Some common use cases include:
- Business management applications
- Inventory and billing software
- Employee management systems
- Desktop dashboards
- File management tools
- Productivity applications
- Media and document utilities
- Internal company applications
The main advantage is code reuse. You can maintain a shared codebase while adjusting the interface and functionality according to each platform.
Can You Build Desktop Applications Using Flutter?
Yes. Flutter officially supports desktop application development on three major operating systems.
| Platform | Supported |
|---|---|
| Windows | Yes |
| macOS | Yes |
| Linux | Yes |
Flutter desktop applications can use native desktop features such as keyboard input, mouse interactions, window management, file access, and platform-specific integrations.
However, desktop applications need a different user experience compared with mobile applications.
For example, a desktop application may require:
- A wider layout with multiple sections
- Sidebar navigation
- Keyboard shortcuts
- Right-click context menus
- File and folder selection
- Resizable windows
- Desktop-friendly forms and tables
Flutter allows you to implement these features using its widget system and compatible packages.
Prerequisites for Flutter Desktop Development
Before creating your first desktop application, make sure you have the required development environment.
You should have:
- Basic knowledge of Dart programming.
- Basic understanding of Flutter widgets.
- Flutter SDK installed on your computer.
- Visual Studio Code or Android Studio.
- Platform-specific desktop development tools.
If you are new to Flutter, you can first explore our Flutter tutorial resources to understand widgets, layouts, and Dart fundamentals.
Windows Development Requirements
To build Flutter applications for Windows, you need:
- Windows 10 or later (64-bit).
- Flutter SDK.
- Visual Studio 2022.
- Desktop development with C++ workload.
- Windows SDK.
- Visual Studio Code or Android Studio (optional).
Important: Visual Studio and Visual Studio Code are different applications. Installing Visual Studio Code alone does not provide the C++ build tools required for Windows desktop builds.
macOS Development Requirements
For macOS desktop development, you need:
- A Mac computer.
- Flutter SDK.
- Xcode.
- Xcode command-line tools.
- CocoaPods where required by your project dependencies.
Linux Development Requirements
For Linux desktop development, you generally need:
- A supported Linux distribution.
- Flutter SDK.
- Clang.
- CMake.
- Ninja.
- GTK development libraries.
- pkg-config.
The exact system packages can vary depending on your Linux distribution and Flutter dependencies.
Step 1: Check Your Flutter Installation
First, open your terminal or command prompt and check whether Flutter is installed.
Run:
flutter --version
This command displays your installed Flutter version.
Next, run:
flutter doctor
Flutter Doctor checks your development environment and identifies missing dependencies.
If you are developing Windows applications, pay particular attention to the Visual Studio section. For macOS, check Xcode, and for Linux, check the required development libraries.
Resolve the relevant issues before proceeding.
Step 2: Enable Flutter Desktop Support
Flutter desktop support is available through the Flutter SDK.
You can check the available desktop devices by running:
flutter devices
To enable Windows desktop support, run:
flutter config --enable-windows-desktop
For macOS:
flutter config --enable-macos-desktop
For Linux:
flutter config --enable-linux-desktop
You only need to enable the platform you intend to develop for.
After enabling support, check the available devices again:
flutter devices
Your desktop device should appear when the required development tools are installed and configured correctly.
Step 3: Create Your First Flutter Desktop Project
Now let’s create a new Flutter project.
Open the terminal and run:
flutter create my_desktop_app
Move into the project directory:
cd my_desktop_app
Flutter creates the standard project structure, including the lib directory and platform-specific folders.
A simplified project structure looks like this:
my_desktop_app/
│
├── android/
├── ios/
├── lib/
│ └── main.dart
├── linux/
├── macos/
├── test/
├── web/
├── windows/
├── pubspec.yaml
└── README.md
The windows, macos, and linux directories contain the native runner projects for their respective platforms.
The lib directory contains your main Dart and Flutter application code.
You can reuse the same lib code across supported platforms, although some platform-specific features may require additional configuration.
Step 4: Create a Simple Desktop Application
Let’s replace the default Flutter application with a simple desktop dashboard.
Open:
lib/main.dart
Replace its contents with the following code:
import 'package:flutter/material.dart';
void main() {
runApp(const DesktopApp());
}
class DesktopApp extends StatelessWidget {
const DesktopApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'My Desktop App',
theme: ThemeData(
colorSchemeSeed: Colors.blue,
useMaterial3: true,
),
home: const DashboardScreen(),
);
}
}
class DashboardScreen extends StatelessWidget {
const DashboardScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Desktop Dashboard'),
),
body: Row(
children: [
Container(
width: 220,
color: Colors.blue.shade50,
child: Column(
children: [
const SizedBox(height: 30),
const Text(
'My Application',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 30),
ListTile(
leading: const Icon(Icons.dashboard),
title: const Text('Dashboard'),
onTap: () {},
),
ListTile(
leading: const Icon(Icons.settings),
title: const Text('Settings'),
onTap: () {},
),
],
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Welcome to Desktop App',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 20),
Wrap(
spacing: 16,
runSpacing: 16,
children: [
dashboardCard(
'Total Users',
'1,250',
Icons.people,
),
dashboardCard(
'Total Orders',
'450',
Icons.shopping_cart,
),
dashboardCard(
'Revenue',
'\$8,500',
Icons.attach_money,
),
],
),
],
),
),
),
],
),
);
}
}
Widget dashboardCard(
String title,
String value,
IconData icon,
) {
return SizedBox(
width: 220,
child: Card(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(icon, size: 30, color: Colors.blue),
const SizedBox(height: 12),
Text(title),
const SizedBox(height: 8),
Text(
value,
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
);
}
This example creates a basic desktop dashboard with:
- A navigation sidebar.
- A dashboard heading.
- Three information cards.
- A desktop-friendly horizontal layout.
- Material Design styling.
You can expand this example by adding authentication, database connectivity, charts, reports, and other application features.
Step 5: Run Your Flutter Desktop Application
Once your code is ready, you can run the application directly on your desktop.
For Windows:
flutter run -d windows
For macOS:
flutter run -d macos
For Linux:
flutter run -d linux
Flutter will compile the project and launch the desktop application.
If you are using Visual Studio Code, you can also select the desktop device from the device selector and press F5 to start debugging.
Tip: Make sure the required desktop development tools are installed before running these commands.
Step 6: Build a Flutter Desktop Application for Windows
Running an application in development mode is different from creating a release build.
To generate a Windows release build, execute:
flutter build windows
After the build completes, Flutter generates the application files inside:
build/windows/x64/runner/Release/
The output contains your application executable along with the required runtime files and libraries.
For example:
Release/
│
├── my_desktop_app.exe
├── flutter_windows.dll
├── data/
└── other required files
The executable depends on the supporting files generated with it. Therefore, do not distribute only the .exe file.
How to Share Your Windows Desktop Application
You can distribute the complete release output directory.
For a better installation experience, you can package your application using an installer creation tool such as Inno Setup or another Windows installer solution.
An installer can help users:
- Install the application in a selected directory.
- Create desktop shortcuts.
- Add Start Menu shortcuts.
- Uninstall the application.
- Manage application files more conveniently.
You should also test the packaged application on a clean Windows machine before distributing it.
Step 7: Build Flutter Desktop Applications for macOS
If you are using macOS, you can generate a release build with:
flutter build macos
Flutter generates the macOS application bundle inside:
build/macos/Build/Products/Release/
You will find an application bundle with the .app extension.
For example:
MyDesktopApp.app
You can test this application on your Mac.
For public distribution, you may also need to configure application signing, notarization, and packaging according to Apple’s distribution requirements.
Step 8: Build Flutter Desktop Applications for Linux
To generate a Linux desktop release build, execute:
flutter build linux
The generated application files are available inside:
build/linux/x64/release/bundle/
This directory contains the executable and its required supporting files.
You can distribute the bundle or package it using a suitable Linux distribution format, depending on your target users.
Common distribution options include:
- Debian packages (
.deb). - RPM packages.
- AppImage.
- Snap packages.
- Flatpak.
The correct packaging approach depends on your target Linux distributions and their requirements.
Step 9: Create a Responsive Desktop UI
Desktop applications have different screen sizes and interaction patterns compared with mobile applications.
A layout designed only for a mobile screen may not look good when opened in a large desktop window.
For better Flutter desktop UI development, consider using:
1. LayoutBuilder
LayoutBuilder allows you to build layouts according to the available space.
Example:
LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 700) {
return const Text('Compact Layout');
}
return const Text('Desktop Layout');
},
)
You can use this approach to switch between compact and expanded layouts.
2. Expanded and Flexible
Use Expanded and Flexible to distribute available space between widgets.
Row(
children: [
Expanded(
flex: 2,
child: Container(color: Colors.blue),
),
Expanded(
flex: 5,
child: Container(color: Colors.green),
),
],
)
This is particularly useful for dashboards, navigation layouts, and multi-column interfaces.
3. SingleChildScrollView
Desktop windows can be resized, so content should remain accessible even when the available space becomes smaller.
SingleChildScrollView(
child: Column(
children: const [
Text('Dashboard'),
Text('Reports'),
Text('Settings'),
],
),
)
For longer lists, consider using ListView.builder instead of creating every list item at once.
You can read our Flutter ListView.builder tutorial to understand efficient list rendering.
4. NavigationRail
NavigationRail is useful for desktop applications that need a vertical navigation menu.
NavigationRail(
selectedIndex: 0,
onDestinationSelected: (index) {},
destinations: const [
NavigationRailDestination(
icon: Icon(Icons.dashboard),
label: Text('Dashboard'),
),
NavigationRailDestination(
icon: Icon(Icons.settings),
label: Text('Settings'),
),
],
)
It provides a more desktop-friendly navigation experience than a typical mobile bottom navigation bar.
Step 10: Add Desktop Features to Your Flutter Application
A desktop application often needs features that are less common in mobile applications.
Here are some useful capabilities you can add.
1. Keyboard Shortcuts
Desktop users expect keyboard shortcuts for common operations.
Flutter provides the Shortcuts, Actions, and Intent widgets for implementing keyboard shortcuts.
For example, you can define a shortcut for a custom action using:
Shortcuts(
shortcuts: {
LogicalKeySet(
LogicalKeyboardKey.control,
LogicalKeyboardKey.keyS,
): const SaveIntent(),
},
child: Actions(
actions: {
SaveIntent: CallbackAction<SaveIntent>(
onInvoke: (intent) {
debugPrint('Save action triggered');
return null;
},
),
},
child: const Focus(
autofocus: true,
child: Text('Press Ctrl + S to save'),
),
),
)
For a complete implementation, define the SaveIntent class and ensure the widget has the appropriate focus behavior.
On macOS, you may also want to support Command-based shortcuts.
2. File and Folder Selection
Desktop applications commonly allow users to select files and folders.
You can use the file_picker package to provide file selection functionality.
Add the package:
flutter pub add file_picker
Example:
import 'package:file_picker/file_picker.dart';
Future<void> selectFile() async {
final result = await FilePicker.platform.pickFiles();
if (result != null) {
final file = result.files.single;
debugPrint('Selected file: ${file.name}');
debugPrint('File path: ${file.path}');
}
}
The selected file path may not be available in every platform or configuration, so handle null values appropriately.
3. Window Management
You may want to control the desktop application’s window size, minimum dimensions, or title.
Packages such as window_manager can help implement window management features.
Add the package:
flutter pub add window_manager
You can use it to configure window properties, such as minimum size and title, after initializing the package.
Always check the package documentation for the initialization and platform-specific requirements of the version you install.
4. Local Database
Many desktop applications need to store information locally.
You can use SQLite through packages such as sqflite_common_ffi for supported desktop environments.
Local databases are useful for:
- Inventory applications.
- Billing software.
- Offline management systems.
- Employee records.
- Personal productivity tools.
Choose a database according to your application’s storage, security, and synchronization requirements.
Step 11: Add State Management to Your Desktop Application
As your desktop application grows, managing application state becomes important.
For small applications, Flutter’s built-in setState() may be sufficient.
For larger projects, you can use state management solutions such as:
- Provider.
- Riverpod.
- Bloc.
- GetX.
For example, Riverpod can help organize application state and separate business logic from the user interface.
If you want to learn more, read our Flutter Riverpod tutorial.
A good architecture makes it easier to maintain features such as authentication, settings, reports, database operations, and API integration.
Step 12: Connect Your Flutter Desktop App to an API
Desktop applications can communicate with backend services just like mobile applications.
You can use the http or dio package to make API requests.
For example, install Dio:
flutter pub add dio
Create an API service:
import 'package:dio/dio.dart';
class ApiService {
final Dio dio = Dio();
Future<void> fetchUsers() async {
try {
final response = await dio.get(
'https://jsonplaceholder.typicode.com/users',
);
print(response.data);
} catch (e) {
print('API Error: $e');
}
}
}
You can call this service from your dashboard or another screen.
Remember to handle loading states, network failures, authentication, and API timeouts properly.
For more information, explore our Flutter Dio API Call tutorial.
Step 13: Test and Debug Your Flutter Desktop Application
Testing is an important part of desktop application development.
You should test your application on the target operating system and verify that the interface works correctly at different window sizes.
Some useful commands include:
Run static analysis:
flutter analyze
Run unit and widget tests:
flutter test
Check available devices:
flutter devices
Run the application in debug mode:
flutter run -d windows
You can also use Flutter DevTools to inspect widgets, analyze performance, and debug application behavior.
For more practical debugging techniques, read our Flutter Debugging guide.
Common Problems in Flutter Desktop Development
While developing desktop applications, you may encounter some common errors.
Here are a few problems and their possible solutions.
| Problem | Possible Solution |
|---|---|
| Windows desktop device not detected | Enable Windows desktop support and check Visual Studio installation |
| Visual Studio toolchain error | Install the Desktop development with C++ workload |
| CMake not found on Linux | Install CMake and required build dependencies |
| Missing GTK libraries | Install the GTK development packages required by Flutter |
| macOS build fails | Check Xcode installation and command-line tools |
| Application crashes on another PC | Include the complete release bundle and required dependencies |
| Plugin not supported on desktop | Check whether the package supports your target platform |
| UI looks incorrect on large screens | Use responsive layouts and desktop-friendly navigation |
Error: No Windows Desktop Device Available
If Flutter does not detect a Windows desktop device, run:
flutter config --enable-windows-desktop
flutter doctor
flutter devices
Also verify that Visual Studio and its required C++ components are installed.
Error: CMake or Linux Dependencies Missing
On Linux, Flutter desktop builds require additional system development tools.
Check the Flutter Doctor output and install the missing dependencies for your distribution.
Error: A Flutter Package Does Not Support Desktop
Not every Flutter package supports Windows, macOS, or Linux.
Before adding a package, check its platform support on pub.dev.
If a package does not support your target platform, look for a desktop-compatible alternative or implement the required functionality using platform-specific code.
Best Practices for Flutter Desktop App Development
Follow these practices to build reliable and maintainable desktop applications.
- Design for larger screens: Use sidebars, navigation rails, tables, and multi-column layouts where appropriate.
- Support window resizing: Make sure your application works at different window dimensions.
- Use keyboard shortcuts: Add shortcuts for frequently used desktop operations.
- Handle mouse interactions: Support hover states, right-click menus, and mouse-based navigation where useful.
- Choose desktop-compatible packages: Always verify package support for Windows, macOS, and Linux.
- Separate business logic: Keep application logic outside UI widgets where practical.
- Optimize performance: Avoid unnecessary widget rebuilds and expensive operations on the main isolate.
- Test release builds: Debug builds are not a replacement for testing the actual release application.
- Secure sensitive data: Do not hardcode API keys, passwords, or other secrets in your application.
- Package the complete application: Include all required runtime files when distributing your software.
Flutter Desktop vs Flutter Mobile Development
Although Flutter uses the same framework for desktop and mobile development, there are some important differences.
| Feature | Mobile App | Desktop App |
|---|---|---|
| Primary input | Touch | Mouse and keyboard |
| Screen size | Usually smaller | Usually larger |
| Navigation | Bottom navigation, drawers | Sidebars, menus, navigation rail |
| Window resizing | Usually not applicable | Important |
| File access | Platform-specific permissions | Desktop file selection |
| Keyboard shortcuts | Less common | Frequently used |
| Distribution | App stores or APK | Installers or platform packages |
| Layout | Mobile responsive UI | Desktop-oriented responsive UI |
You can share much of your Flutter application code across platforms, but the user interface should be designed according to the platform.
Frequently Asked Questions (FAQs)
1. Can I create a Windows desktop application using Flutter?
Yes. Flutter officially supports Windows desktop development. You can create a Flutter project, enable Windows desktop support, and generate a release build using flutter build windows.
2. Can Flutter create desktop applications for macOS and Linux?
Yes. Flutter supports macOS and Linux desktop applications. You need the appropriate development tools for each operating system to build and test your application.
3. Can I use the same Flutter code for mobile and desktop applications?
Yes. You can share common Dart code, business logic, API services, and many UI components across platforms. However, some features and layouts may need platform-specific implementations.
4. How do I generate an EXE file using Flutter?
Run the following command on a configured Windows development machine:
flutter build windows
The generated executable is located in the Windows release output directory under build/windows/x64/runner/Release/. Distribute the complete output folder rather than only the executable.
5. Do I need Visual Studio for Flutter Windows development?
Yes, you need the Visual Studio C++ build tools for Windows desktop development. Install Visual Studio with the Desktop development with C++ workload. Visual Studio Code alone is not sufficient.
6. Is Flutter good for desktop application development?
Flutter is a good option for many cross-platform desktop applications, especially when you want to share code between mobile and desktop platforms. It is suitable for dashboards, business tools, productivity applications, and other custom interfaces.
7. Can I use Firebase in a Flutter desktop application?
Firebase functionality depends on the specific Firebase product and its supported platforms. Check the official FlutterFire documentation and the compatibility of individual packages before choosing your architecture.
8. Can I publish a Flutter desktop application?
Yes. You can distribute desktop applications through your own website, company infrastructure, or supported application distribution platforms. You should configure platform-specific signing, packaging, and security requirements before public distribution.
9. Is Flutter desktop development free?
Flutter is an open-source framework and can be used without paying a framework license fee. However, operating system requirements, developer accounts, code-signing certificates, hosting, and other distribution services may involve costs.
10. Can I convert an existing Flutter mobile app into a desktop application?
Yes. You can add desktop platform support to an existing Flutter project and adapt its interface for larger screens. However, you should verify that all dependencies and plugins support the desktop platforms you want to target.
Conclusion
Flutter Desktop App Development makes it possible to create applications for Windows, macOS, and Linux using Flutter and Dart.
You can start with a simple Flutter project, enable desktop support, build a desktop-friendly interface, and generate release applications using platform-specific build commands.
The biggest advantage is code reuse. Developers who already work with Flutter can use their existing skills to build desktop applications without learning an entirely different UI framework.
Start with a small project, experiment with desktop layouts, add features such as file selection and keyboard shortcuts, and gradually build a complete desktop application.
With the right architecture and platform-specific adjustments, Flutter can be a practical choice for developing modern cross-platform desktop software.
