How to create a flutter desktop application
How to create a flutter desktop application
Prepare
- Upgrade the flutter latest release.
bin\flutter channel master bin\flutter upgrade - Check environment.
bin\flutter doctor - Set enviroment variable.
set ENABLE_FLUTTER_DESKTOP=true - Show all connected devices
bin\flutter devices5.Clone the flutter-desktop-embedding repository.
git clone https://github.com/google/flutter-desktop-embedding.git - Change directory to example
cd flutter-desktop-embedding\example - Get packages.
flutter packages get - Download build tools by your system.
flutter precache --windows
Start
- Start your first desktop application.
flutter run - The app code placed at flutter-desktop-embedding\example\lib\main.dart. When the flutter running, press r to hot reload after you modified the app code.
- If you want to change the title, you can modify the file flutter-desktop-embedding\example\windows\flutter_embedder_example.cpp to change it. Then quit the
flutter runand restart it. The title changed. - If you minimize the desktop application, it will quit automatically.
