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.

Share:
294
Prince Hodonou
Author by

Prince Hodonou

Updated on December 07, 2022

Comments

  • Prince Hodonou
    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.

    enter image description here

  • Prince Hodonou
    Prince Hodonou over 5 years
    Thanks, 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
    Günter Zöchbauer over 5 years
    Not enough information. Please add pubspec.yaml to your questin.
  • Prince Hodonou
    Prince Hodonou over 5 years
    I added a screenshot of my pubspec.yaml
  • Prince Hodonou
    Prince Hodonou over 5 years
    flutter packages get
  • Günter Zöchbauer
    Günter Zöchbauer over 5 years
    Weird. You have a ' at the end of flutter' 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
    Prince Hodonou over 5 years
  • Prince Hodonou
    Prince Hodonou over 5 years
    Hello, 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
    Günter Zöchbauer over 5 years
    You probably are reloading the project that runs jaguar_hotreload, but that is unrelated to Flutter. You can pass an alternative vmServiceUrl to HotReloader 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.