This setup is only for MacOS. I don't have a windows/linux machine to test.
cd ~
git clone https://github.com/google/flutter-desktop-embedding
flutter channel master
Because current master is not pointing to latest commit
cd ~/flutter
git pull origin master
This enables experimental features. Add it to your .profile or rc file if you don't want to run this for every terminal session.
export ENABLE_FLUTTER_DESKTOP=true
flutter doctor
It shoulds say there is one connected device
This doesn't have to be inside FDE folder
flutter create hello_world
cp -R ~/flutter-desktop-embedding/example/macos hello_world/macos
Note: This step is not required anymore because FDE_ROOT has been eliminated from flutter-desktop-embedding project. Thanks @stuartmorgan for the heads up!
Open hello_world/macos/Runner.xcodeproj/project.pbxproj
in a code editor. You can do this from Xcode as well.
Replace this
FDE_ROOT = $PROJECT_DIR/../..;
with this
FDE_ROOT = $HOME/flutter-desktop-embedding;
There will be two instances to replace.
Flutter framework code doesn't cover macos/linux/windows platforms yet.
So we have to override platform with an existing one like this:
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart'
show debugDefaultTargetPlatformOverride;
void main() {
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia;
runApp(MyApp());
}
export ENABLE_FLUTTER_DESKTOP=true
flutter run -d macos
flutter build macos
cd build/macos/Build/Products/Release/
export ENABLE_FLUTTER_DESKTOP=true
open -a Android\ Studio
open -a Visual\ Studio\ Code
Related: flutter on mac desktop “No devices detected”