DEV Community

Cover image for Flutter Desktop Development Practice
RustDesk
RustDesk

Posted on

Flutter Desktop Development Practice

We mentioned earlier that RustDesk's original Html / Js (Sciter)-based front-end was migrated to Flutter. We have to admit the migration progress was much slower than expected. It seems wrong to choose Flutter, but there were no other better choices indeed.

Tauri seems to be the best choice, but the performance does not meet our requirement. Sciter uses Html / Js, but it has its own rendering engine with native Video interface. Tauri uses its Wry to unify the API interfaces of browsers on various platforms, but it cannot break the limitations of browser boundary, and the customizability and compatibility are also worse than Electron. I still like Tauri very much, because it is small and pretty, convenient for development and debugging, and efficient enough to meet the production needs of most scenes. I look forward to its future, and I hope their own rendering implementation can be achieved as soon as possible.

Qt seems a more practical choice, but after seeing its unsafe Rust binding of Qt, we gave up.

The front-end development of Flutter is similar to the native UI development, the complexity is significantly higher than classic Web technology. This can be seen from the number of lines of source code after our migration. The code is much more verbose and bloated, although it leads to better engineering practices and maintainability (This doesn't mean too much for a small team like us in my opinion).

Flutter desktop is still buggy, and much more worse than expected. Here are some featured problems we have encountered, and our solutions.

1,Multiple Windows Support

https://github.com/Kingtous/rustdesk_desktop_multi_window

This Pub supports Flutter <=3.0.5 on Windows. There is a related issue on Flutter repo, but the priority is low. As a work around, We stick to the old version of Flutter. We haven't seen any obvious improvements for Windows in the new Flutter version, using new Flutter version is not that important. It seems that the Flutter team focuses on Android / iOS, and many basic problems of Flutter desktop (multi-level menus, local cursor, scrollbar) have been ignored.

2,Better Window Operation

https://github.com/leanflutter/window_manager/pull/205

https://github.com/leanflutter/window_manager/pull/203

3,Native Cursor

https://github.com/flutter/engine/pull/36143

https://github.com/Kingtous/rustdesk_flutter_custom_cursor

4,Multi-level Menus

We try to avoid using multi-level menus. There is a native menu implementation, but it is not easy to customize.

5,Scroolbar

The wheel speed is slow, and the wheel stops to work when the cursor is moved on the scrollbar.

https://github.com/Kingtous/flutter_improved_scrolling

6,Bridge

https://github.com/fzyzcjy/flutter_rust_bridge/pull/663

7,Wayland

https://github.com/leanflutter/screen_retriever/pull/3

8,CJK Font

https://github.com/flutter/flutter/issues/103811#issuecomment-1199227834
https://github.com/rustdesk/rustdesk/pull/1581/files

Top comments (1)

Collapse
 
jakemonton profile image
Jake Monton

Hi, just curious on your comment regarding Tauri's performance. Do you think Electron is better than Tauri in terms of performance? Just wanted to hear your feedback as we are on the hunt of what framework we are going to use to build our next desktop project.

Thanks