Dropsource / monarch

Monarch is a tool for building Flutter widgets in isolation. It makes it easy to build, test and debug complex UIs.
https://monarchapp.io
MIT License
433 stars 22 forks source link

On Linux: implement hot restart #70

Closed fertrig closed 1 year ago

fertrig commented 1 year ago

Monarch lets users hot reload and hot restart stories on macOS and Windows. On Linux, users can hot reload, however hot restart is not implemented.

We are hoping to get help from the community on this issue.

The CLI dart code already handles the user request to hot restart. What's missing is the platform implementation to close the preview window and open a new one. Below are the implementations on macOS and Windows. The Linux implementation would be similar.

On Windows, see platform/windows/src/window_manager.cpp, function restartPreviewWindow(): https://github.com/Dropsource/monarch/blob/46d4f79b3649960eff371aaf51192da999ff8e74/platform/windows/src/window_manager.cpp#L231

On macOS, see platform/macos/monarch_macos/WindowManager.swift, function restartPreviewWindow(): https://github.com/Dropsource/monarch/blob/46d4f79b3649960eff371aaf51192da999ff8e74/platform/macos/monarch_macos/WindowManager.swift#L126