How do you manually hot reload Flutter
294
https://pub.dartlang.org/packages/jaguar_hotreload/versions/0.2.0 works for me to make my Dart server app reload itself every time a file changes.
On GitHub is a Dart2 compatible version. I don't know why they didn't publish it yet, but you can use it from there.
Author by
Prince Hodonou
Updated on December 07, 2022Comments
-
Prince Hodonou over 1 year
Im writing a node js app to manipulate Flutter code by adding lines of code to it. I want to see updates in real time. Is it possible to somehow hot reload Everytime I'm done writing a line in the file? I'm using visual studio code. I've tried using robot.js to simulate key press but those send keys to the nodejs terminal and not to Flutter.
-
Prince Hodonou over 5 yearsThanks, but I'm stuck on an error. "Because project_name depends on flutter any from sdk which doesn't exist (unknown SDK "flutter'"), version solving failed." I'm can't get rid of it.
-
Günter Zöchbauer over 5 yearsNot enough information. Please add pubspec.yaml to your questin.
-
Prince Hodonou over 5 yearsI added a screenshot of my pubspec.yaml
-
Prince Hodonou over 5 yearsflutter packages get
-
Günter Zöchbauer over 5 yearsWeird. You have a
'
at the end offlutter'
that looks wrong. Compare it with the pubspec.yaml of another project to see how it should look like. Also your approach can't work because the code runs on a device or emulator and can't see file changes on your developer machine. You'd need an extra process that does the file watching and invoking hot-reload. -
Prince Hodonou over 5 yearsLet us continue this discussion in chat.
-
Prince Hodonou over 5 yearsHello, I was able to set up a file watcher and it reloads when the file specified is changed. However, the actual app on the emulator isn't reloading. How do I get the watcher to actually re-render the app?
-
Günter Zöchbauer over 5 yearsYou probably are reloading the project that runs jaguar_hotreload, but that is unrelated to Flutter. You can pass an alternative
vmServiceUrl
toHotReloader
and that one needs to point to the mobile device and the Dart instance running there. It should print the service port when it is started.