Open JeroMiya opened 5 years ago
The Xamarin team work on this feature.
@mohachouch I wasn't aware (do you have a link with details?) though I suspect what they are implementing is either full app reload at the assembly level or hot reload of XAML only, or both. For us, we could take advantage of any assembly hot reload functionality they might have, but we'll still need to implement something ourselves if we want a stateful hot reload.
It’s a tweet from Miguel De Icaza https://twitter.com/migueldeicaza/status/1076488386439974912
Implementing by ourselves would be a gigantic, if not impossible, effort. It's not just on client side, it's also tooling. What they are doing is using an interpreter (which Mono recently got) and integrating that into IDE and debugger (hopefully both).
@MihaMarkic I realize stateful hot reload can't be a priority for this stage of development, but difficult or not on a technical level, stateful hot reload is a hard requirement. It is THE top feature of Flutter and probably why most Flutter developers started using it. Perhaps not at the level of support available in Flutter, which would require VM level support for hot code reloads with preserved state (and detection of incompatible changes), but perhaps by storing the "state" of the app in a serializeable form that can survive a full hot reload of the entire app assembly?
@JeroMiya While that might be achievable, the debugger and IDE support is not.
So obviously this isn't the highest priority for version 1 given that the transpiler isn't complete, but I thought I'd bring it up in case planning for this feature might affect design decisions going forward.
Basically, state-full hot reload would be implemented using a client/server architecture whereby a server on the development machine watches for file changes and sends updates to the running flutter engine, which then dynamically recompiles views on the fly, preserving state.
This is similar to how livexaml and HotReload work. The tricky bit is dynamically recompiling views, given that they are now C# code and not xaml files. Perhaps in debug mode the whole app runs in interpreted mode and gets live reloaded? Can we use the mono interpreter?