Comments (13)
Now that attach mode has been added to Dart Code, adding hot reload should be doable without any hackery since it's exposed via the observatory's reloadSources command. Assuming that works as well as the daemon reloads (I haven't tested yet) it would just be a case of adding a Dart Code command to invoke it.
from flutter-desktop-embedding.
I consider this a strong selling point for developers. Hot reload is frigging awesome!
from flutter-desktop-embedding.
The reason it's still open is that the current instructions still use the device-id
hack rather than something supported. Most of the necessary work to move away from that is done now, but there's a bit more needed before the VS Code workflow that's currently documented can switch.
from flutter-desktop-embedding.
No, see my last comment.
from flutter-desktop-embedding.
Did some research on this. Not sure if it will be useful to anyone
-
I added fake device and hardcoded executable path and Uri on both sides.
flutter run
would then launch the .app and correctly perform the 'r' reload. 'R' reload did not work. -
full reload did not work because it is not handled in the embedder: https://github.com/flutter/engine/blob/master/shell/platform/embedder/platform_view_embedder.cc#L53. I could make it work by copying some code from the ios platform view. This made flutter run + R work.
-
VSCode extension uses daemon, which somehow performs hot reload and restart differently than the run command. Nor debugging nor reloading would work. Something about invalid UTF8 would appear when trying to reload.
from flutter-desktop-embedding.
I haven't looked at reload support yet, so I don't have any extra insight into what all is necessary. I think we'll need to discuss with Flutter developers how reloading should work in the embedding model though (e.g., it might make sense for it to be exposed as an embedding API). At a high level, I don't think we want people to have to launch applications with flutter run
to get tooling support.
from flutter-desktop-embedding.
Thanks for the answer. I got it to work somehow. Perhaps by switching to flutter's master branch. For anyone interested these are the steps required:
- Create hardcoded desktop device. I used port 5300.
szotp/flutter@5c06b5d - Supply these arguments in the client:
[CommandLine.arguments[0], "--observatory-port=50300", "--start-paused"]
- Launch the app from Xcode.
- Open the project_example in Visual Studio Code. Make sure it works on iOS (plist needed).
- Press F5. Debugging and hot reload should work. Restart reload requires some changes in the engine.
I think I could improve the fork and prepare it for merge:
- Add flag in the config to enable the desktop device so only people interested in it can see it.
- Execute some script in the flutter, perhaps $(PROJECT_DIR)/launch.{sh/bat} that will compile and launch the app, so we don't have to do it manually via Xcode. Script would also return an Uri to connect.
from flutter-desktop-embedding.
hi @szotp I got this error while using that hacks
NoSuchMethodError: Class 'AppDomain' has no instance method 'startApp' with matching arguments.
Receiver: Instance of 'AppDomain'
Tried calling: startApp(Instance of 'DesktopDevice', "/Users/wizard/Desktop/DEV/flutter-desktop-embedding/example_flutter", "lib/main.dart", null, Instance of 'DebuggingOptions', true, applicationBinary: null, dillOutputPath: null, ipv6: false, packagesFilePath: null, projectRootPath: null, trackWidgetCreation: false)
Found: startApp(Device, String, String, String, DebuggingOptions, bool, {String applicationBinary, bool trackWidgetCreation, String projectRootPath, String packagesFilePath, bool ipv6}) => Future<AppInstance>
Exited (1)
from flutter-desktop-embedding.
With IntelliJ I was able to attach the debugger using the "Dart Remote Debug" run configuration. However it looks like hot reload isn't supported yet when attaching in this way.
There is an open issue to implement this. See: flutter/flutter-intellij#2250
from flutter-desktop-embedding.
Based on recent discussion in a Dart Code issue, hot reload via the observatory relies on a hook that's registered by flutter-tools, so just attaching to a desktop process won't allow hot reload after all.
It looks like we'll probably need either some kind of hook in the Flutter tools, or a desktop runner that provides the same functionality.
from flutter-desktop-embedding.
Is there a good news?
from flutter-desktop-embedding.
I think this issue can be closed because hot reload have been implemented in flutter attach
already.
from flutter-desktop-embedding.
Moved to flutter/flutter#30707 (solving the devices
issues for run
would address the attach
case as well, so that issue covers both).
(Debugging.md will continue to be updated as the need for special handling changes.)
from flutter-desktop-embedding.
Related Issues (20)
- window_size null-safety HOT 1
- Flutter launch error HOT 7
- setInitialRoute for Windows flutter::FlutterViewController HOT 1
- Window size is not correct when i first lunch the app unless i drag it HOT 3
- can't set window size. HOT 4
- App crashes if first minimize the window and then call setWindowVisibility(visible: true) HOT 1
- Throws MissingPluginException during test HOT 2
- setWindowMinSize and setWindowMaxSize not working in Flutter 2.8.0 on Windows 11 HOT 2
- Could not find a file named "plugins/file_chooser/pubspec.yaml HOT 4
- File Description HOT 1
- Linux on ARM: window_size causes "pub get" to hang HOT 3
- [menubar] 'MenuItem' is imported from both 'package:flutter/src/widgets/platform_menu_bar.dart' and 'package:menubar/src/menu_item.dart' HOT 1
- [window_size] Window size cause GitHub timeout during flutter pub get HOT 1
- [menubar] Add "disabled" boolean on NativeMenuItem HOT 1
- Auto-Update flutter desktop app like Discord and Telegram desktop apps HOT 2
- DPI scale reactor needed HOT 1
- Git error. Command: `git clone --mirror git://github.com/google/flutter-desktop-embedding.git HOT 1
- [window_size] setWindowMinSize calculates window size without using DPI on some Windows version HOT 1
- is there in Flutter itself already ? HOT 1
- Run Flutter app in windows 32 bit HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter-desktop-embedding.