Closed antonbashir closed 1 year ago
I don't think I'll add support for this directly, but I don't see why killing and starting a new isolate wouldn't work. Just call Dart_ShutdownIsolate
and then reload your library with DartDll_LoadScript
. Using DartDll_RunMain
makes this a bit more complicated though...
However, if you just want something similar to Flutter's hot reload, dart hot reload actually works out of the box, you don't need to kill and relaunch the isolate.
You can try it out by just attaching a debugger and letting the debugger send the hot reload commands, or you can look into how the hotreload package works and send the commands yourself.
I thought hotreload and other solutions which based on Dart VM Service reloadSources method are working only if Dart is running in JIT mode but not in AOT. Thank you for answer, you confirmed my expectations about that it is possible.
Ah, yes, AOT is actually a whole different story, and hot reload would only work on JIT targets.
That said, this library doesn't support AOT yet anyway, so we'd have to revisit once AOT is supported.
Is it possible to take current Dart SDK version without additional modifications and make reloading of Dart libraries based on this project ?
Example use case:
I know that it requires some work but my question is about theoretical probability without Dart SDK/VM code modifications