I using the desktop flutter and i searched for a way to do that i couldnt find any articles about that sp ii want to know how to change the launcher app icon for windows desktop and also for mac and linux.
I using the desktop flutter and i searched for a way to do that i couldnt find any articles about that sp ii want to know how to change the launcher app icon for windows desktop and also for mac and linux.
To change the icon you just need to replace the icon file in your project:
Linux doesn't have an icon set up in the template yet; you can follow this issue for updates.
To change the icon in windows you have to keep the icon file in this location:
windows/runner/resources/
Then go into windows/runner/resources/Runner.rc file and search for the word app_icon. You will reach here:
IDI_APP_ICON ICON "resources\\app_icon.ico"
Replace the app_icon with your icon file name. Then run the command
flutter build windows
flutter run --release -d windows
Here is my setup from flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19043.1110], locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.3)
[✓] Android Studio (version 4.1.0)
[✓] Android Studio
[✓] Connected device (3 available)
• No issues found!
Initially it didn't work by just replacing the icon and run
flutter build windows
and neither did
flutter clean
flutter build windows
I found that in the running mode the icon updates on the GUI, but unfortunately not in the EXE itself.
flutter run --release -d windows
For Linux
Best And Simple way is to use gtk_window_set_icon_from_file function
Edit Your my_application.cc file which is inside Linux folder linux/my_application.cc
gtk_widget_show(GTK_WIDGET(window));gtk_window_set_icon_from_file(GTK_WINDOW(window),"assets/icon.ico",NULL);I hava the best way, using Flutter Launcher Icons for your Windows, Android etc.
dev_dependencies: flutter_launcher_icons: "^0.10.0"
flutter_icons: android: "launcher_icon" ios: true image_path: "assets/icon/icon.png" min_sdk_android: 21 # android min sdk min:16, default 21 web: generate: true image_path: "path/to/image.png" background_color: "#hexcode" theme_color: "#hexcode" windows: generate: true image_path: "path/to/image.png" icon_size: 48 # min:48, max:256, default: 48
flutter pub get flutter pub run flutter_launcher_icons:main
Note: Name of your icon is lowercase, don't use capital.