Show HN: Rust GUI Library via Flutter
301 points
28 days ago
| 16 comments
| cjycode.com
| HN
Hi, I made a bridge (https://github.com/fzyzcjy/flutter_rust_bridge v2.0.0) between Flutter and Rust, which auto translates syntaxes like arbitrary types, &mut, async, traits, results, closure (callback), lifetimes, etc. The goal is to make a bridge between the two, seamlessly as if working in one single language.

Then, as an example, I showed how to write Rust applications with GUI by utilizing Flutter. That is discussed in the link in details.

To play with it, please visit the GitHub repo, or refer to the end of the article for detailed folders and commands.

When I first released 1.0.0 years ago, it only contained few features compared to today. It is the result of the hard work of contributors and me, and many thanks to all the contributors!

tmpfs
28 days ago
[-]
I have been using this to build an app[0] for the last couple of years and I want to say that it has been a pleasure to use, there are some wrinkles but overall I have been very happy with the experience.

Upgrading from v1 to v2 was not too difficult and v2 is a significant upgrade with lots of useful features, massively improved codegen experience and support for tokio async were the big gamechangers for me.

Writing all the app business logic in Rust and using Dart as the front-end works out really well. I know Flutter/Dart doesn't get much love here on HN but in my opinion I think it's much easier to reason about than a system like React which I think is the wrong level of abstraction compared to Flutter's render the entire widget tree approach.

Massive thanks to @fzyzcjy for all the work on FRB, great job!

[0]: https://saveoursecrets.com

reply
bmitc
28 days ago
[-]
Flutter is not bad, but I hesitate diving into it based upon who controls it. Using a Google product feels like you're in constant threat of it just disappearing.

It also still has all the remnants of mobile and fingers and not desktop and mouse. Support for improving this is non-existent in my experience.

reply
sgarg26
27 days ago
[-]
If this takes off it is only a matter of time before someone creates a rust based engine around this framework that does not rely on Google. For now, one pro of google maintaining flutter is that they also maintain android.
reply
seabrookmx
28 days ago
[-]
Why conflate Google's customer facing products with their OSS technology contributions? It seems a weird comparison to make, as if their sales and marketing departments are the ones behind technology decisions.

Angular came out of Google and hasn't gone anywhere. Also GoLang.. even GWT was supported well past its prime and is now maintained by the community. What evidence is there that they abandon languages and frameworks?

reply
epcoa
28 days ago
[-]
> Angular came out of Google and hasn't gone anywhere.

I think you actually answered your own question.

The difference is that Angular was already a hugely adopted and relatively simple piece of technology (the difference between a JavaScript framework and all the moving parts and pieces of Flutter/Dart is huge)

Since the latter doesn’t have anywhere near the investment outside Google it’s not a fair comparison. The fear that if Google drops it, it will die are legitimate.

reply
seabrookmx
25 days ago
[-]
What about the GoLang comparison?

> The fear that if Google drops it, it will die are legitimate

I'm not trying to argue against the fact it would die or not. I'm mainly trying to understand why people think Google would abandon it. Abandoning Google Reader and abandoning Flutter or GoLang are _not_ the same in my eyes, and I can't think of any cases where Google has abandoned a technology rather than a consumer facing product in this fashion.

reply
neonsunset
27 days ago
[-]
> Why conflate Google's customer facing products with their OSS technology contributions?

In the .NET block down the street, we deal with this kind of nonsense almost daily :) https://news.ycombinator.com/item?id=41195650

reply
justahuman74
27 days ago
[-]
To be fair, your linked post encourages ignoring packaging guidelines in linux distributions
reply
MrJohz
28 days ago
[-]
> I know Flutter/Dart doesn't get much love here on HN but in my opinion I think it's much easier to reason about than a system like React which I think is the wrong level of abstraction compared to Flutter's render the entire widget tree approach.

Could you expand on this a bit? My impression was that Flutter and React had relatively similar approaches to components, but I haven't had much experience with Flutter yet, so I'm interested to hear your experiences!

reply
mdhb
28 days ago
[-]
I’m too lazy right now to get into all of the specifics but just wanted to drop a quick note to say that I’ve been doing web development since 1997 and the difference between React and Flutter is like day and night.

It’s genuinely hard for me to overstate the general quality of life improvements both from the developer experience and the overall quality of the apps I can produce in any given time frame.

A big part of the reason for that is Dart is itself hands down the nicest language I’ve ever worked with. The team behind it got real serious when it comes to tooling and language design and everytime I have to go back to TypeScript I feel like I’m trying to run with a 50kg backpack on.

reply
tmpfs
28 days ago
[-]
At a basic level Flutter renders the entire widget tree and caches components that don't need to re-render rather than applying a diff of changes to the DOM.

But it's really the Flutter/Dart API and widgets that make it much easier to work with, if I need to load some data asynchronously I use a `FutureBuilder`, if I need a stream of events I can use `StreamBuilder` etc. Compared to Reacts state, hooks, memo, effects etc. you end up with code that is far easier to reason about what is rendering when and why.

Oh and the real killer feature is Flutters hot reload experience, it's easily the best DX I've seen for GUI work.

As another comment mentioned it really is like night and day. I recommend giving it a try.

reply
MrJohz
28 days ago
[-]
I don't quite understand the point about rendering, unless you mean it in the Angular sense (i.e. on every state update, the whole app gets rendered, and elements are updated to the new state during that render).

But I can imagine that the API can be easier. I think React handles state fairly well, but as soon as that state needs to interact with things outside the React world (http requests, continuously updating data, etc) then the current abstractions don't quite feel right.

reply
fngjdflmdflg
27 days ago
[-]
>i.e. on every state update, the whole app gets rendered

Yes, that's basically correct:

>Calling setState notifies the framework that the internal state of this object has changed in a way that might impact the user interface in this subtree, which causes the framework to schedule a build for this State object.[0]

The `build` method rebuilds the entire widget tree. So "the whole app" does not necessarily get re-rendered, only whatever is in the same widget as the changed state or below it, although potentially that can be the whole screen. Flutter also uses an algorithm to detect unchanged widgets and reuse them,[1] but conceptually the whole thing is re-rendered on state change.

[0] https://api.flutter.dev/flutter/widgets/State/setState.html

[1] https://docs.flutter.dev/resources/inside-flutter#linear-rec...

reply
elbear
27 days ago
[-]
React doesn't work in the same way? I don't know much about it, but I assumed it does.
reply
fngjdflmdflg
27 days ago
[-]
I'm not sure. Hopefully someone here can let us know. I didn't mean to imply that react doesn't work that way.
reply
satvikpendem
27 days ago
[-]
It does work that way. However, Flutter and now React (via their new compiler) are becoming smarter at rerendering, where they will only rerender what has truly changed, not just rerender the entire tree below the changed component.
reply
beanjuiceII
28 days ago
[-]
react and flutter are pretty much the same thing, i do both for a living i am not sure what this person is going on about
reply
nu11ptr
28 days ago
[-]
React = one small piece of a very large required ecosystem (HTML + CSS + Javascript + NPM + React + Vite + ???)

Flutter = a UI framework for mobile/desktop/web (Flutter + Dart)

On top of the purpose built nature, nearly everything is a Widget, even layout/styling making it pretty easy to grok very quickly.

reply
amelius
28 days ago
[-]
I personally prefer using many smaller components over using a large opinionated framework. But I'm not a big fan of React, so this could be better and worth a try.
reply
tensor
28 days ago
[-]
It's less a "large opinionated framework" and more "fewer components overall. There is no HTML/CSS for example, it goes direct from Dart (equivalent to JS) to the Widget rendering system."

Dart has its own build tools and package system that work well. You can still pull in dart libraries as you need them. Dart is also a much better language than JS. I can't tell you how many days I've lost to react/JS build tooling issues. A single problem can easily eat an entire day. With flutter/dart I haven't had a single issue like that.

reply
synergy20
28 days ago
[-]
flutter does a so so job on desktop and it's web version is wasm based.

the job market for dart flutter is a drop while react is the lake.

react with electron, react native, react itself together are still the only ones production ready cross platform GUI with widest adoption

reply
mdhb
28 days ago
[-]
comments about job markets aside…

The first and the third paragraphs really haven’t been true for some time now.

Flutter is absolutely production ready as a cross platform GUI.

reply
pzo
27 days ago
[-]
For ios and android maybe but I doubt for web. Also 12k+ open issues, team layoffs and all founders that left don't brink confidence to flutter. I think also roadmap and progress in last year doesn't look stellar.

On the other hand I think flutter lost a lot of benefits comparing to 5 years ago - now we have stable better swift and swiftui and better kotlin with jetpack compose - those support also apple watch, macos, tvos, visions os, Google wear, Google TV and with current jetbrains compose desktops like windows is already stable.

React native and web ecosystem also improved a lot in the last year.

reply
mdhb
27 days ago
[-]
I keep seeing this coming up and I have no idea where it’s coming from like it’s some self reinforcing feedback loop based on just utter bullshit.

If I am remembering correctly the headcount on the Futter team literally changed by a single person.

Here are some actual real life numbers you can use if you want to gauge the health of the two projects:

1. https://github.com/facebook/react-native/pulse

2. https://github.com/flutter/flutter/pulse

Specifically Flutter’s 108 merged pull requests to React Native’s 1 and Flutter’s 330 closed issues to React Native’s 18.

Also note that this doesn’t even include their rendering engine which had another 90+ closed pull requests https://github.com/flutter/engine/pulse

The truth of the matter is that Flutter is actually is far better shape both from a technical and open source perspective.

reply
pzo
27 days ago
[-]
I did checked pulse for those on github on regular bases. Change to monthly and notice out of 450commits more than 170 commits are by flutter-engine-autoroll bot just auto updating some packages, then next second user did ~30commits, then you have few another flutter bots with some commits. Then go compare with react native.
reply
mdhb
27 days ago
[-]
You are cherry picking things here. If this is some ideological thing for you I’m really not interested in having that conversation.

The health of the two projects genuinely isn’t close at all. Comparing what they are actually both shipping in terms of features in the last year is two very very different stories.

reply
pzo
27 days ago
[-]
I'm neither flutter nor react native developer just native mobile dev but evaluating both techs so don't have stake in the game right now. Just showing to other so they can make their own judgement:

Flutter monthly pulse: https://github.com/flutter/flutter/pulse/monthly "Excluding merges, 83 authors have pushed 451 commits to master and 461 commits to all branches" but:

1st engine-flutter-autoroll (bot with revisions autoroll): 185 commits

2nd zanderso (google employee): 25 commits

3rd ValentilVignal (contributor): 14 commits

in top 15 contributors for flutter you have also other bots such as: fluttergithubbot, auto-submit[bot], flutter-pub-roller-bot, dependabot[bot]

React Native monthly pulse: https://github.com/facebook/react-native/pulse/monthly "Excluding merges, 84 authors have pushed 437 commits to main and 575 commits to all branches"

1st cipolleschi (meta employee): 92 commits

2nd cortinico (meta employee): 83 commits

3rd NickGerleman (contributor): 45 commits

no bots in top 15 contributors

Also keep in mind React Native is based on React repo project. On top of that you have a lot of work by community in:

- expo https://github.com/expo/expo

- react native reanimated https://github.com/software-mansion/react-native-reanimated

- react navigation https://github.com/react-navigation/react-navigation

- react native skia https://github.com/Shopify/react-native-skia

All of those packages are highly maintained and are pretty used in all RN projects and considered standard.

reply
synergy20
27 days ago
[-]
super useful info
reply
satvikpendem
28 days ago
[-]
They do have similar approaches, I'm not sure what the above commenter is saying as both work basically the same (with React class components at least). Flutter doesn't have hooks but they're addressing that via macros next year, and anyway today there are packages like flutter_hooks and ReArch that enable hook-like functionality in Flutter today.
reply
satvikpendem
28 days ago
[-]
But, Flutter and React work the same way where UI is a function of state. In fact, Flutter started off imperatively but after React was released, they changed it to be declarative, and now Android via Jetpack Compose is changing to be declarative, all on the same general principle. I also use packages like flutter_hooks or ReArch which make encapsulating state much easier, I couldn't stand using initState and not forgetting to dispose for each piece of functionality.
reply
fzyzcjy
28 days ago
[-]
You are welcome, and happy to hear it works for you!
reply
nu11ptr
28 days ago
[-]
> I know Flutter/Dart doesn't get much love here on HN but in my opinion I think it's much easier to reason about than a system like React which I think is the wrong level of abstraction compared to Flutter's render the entire widget tree approach.

Yeah I really like Flutter/Dart. I had less an issue with React itself than I did the whole HTML/CSS/Javascript ecosystem and tooling. Flutter is a breath of fresh air in that it is a purpose built ecosystem for UIs. You load the SDK and are ready to go with features like hot reload out of the box. No need for gamut of tools and to figure out how they all work together. Also, no need for HTML + CSS! I think the only reason it isn't more popular is because we have such a huge # of frontend devs already trained on HTML/CSS/JS, as Flutter is a lot simpler out of the gate, and much easier for traditional GUI paradigm people IMO.

reply
samstave
28 days ago
[-]
Just want to say, your site is very aesthetically pleasing. I hate blue websites (FB Blue) -- but the deep tones that SOS uses and contrasts are really appealing.

So is the app, subscribed.

reply
nu11ptr
27 days ago
[-]
Looks nice. What UI design system did you use here if I can ask?
reply
blopker
28 days ago
[-]
While I don't see the advantage of writing UI in Rust vs Dart, I'm a huge fan of flutter_rust_bridge.

The work fzyzcjy and the community have put into calling Rust code from Dart seamlessly is such an asset to Flutter apps. I remade the popular image compression app ImageOptim in Flutter over a weekend because webp wasn't supported. After a little pain in the initial setup, I was able to call mature Rust image libraries using flutter_rust_bridge and a small wrapper[0]. It even handled all the parallelism for me.

The app ended up being more capable and faster than ImageOptim, largely just because of the Rust integration. Thank you fzyzcjy!

[0]: https://github.com/blopker/alic/blob/main/rust/src/api/compr...

reply
fzyzcjy
28 days ago
[-]
You are welcome, and I am happy to see it helps! When I initially develop flutter_rust_bridge, my personal usage scenario is quite similar to yours: using Rust for some high performance algorithms.
reply
bubblebeard
28 days ago
[-]
Commendable effort! I’m currently using Tauri for a project myself and was wondering if anyone has any pros/cons between the two?
reply
fzyzcjy
28 days ago
[-]
Thank you! I heard some people saying that, for apps using JavaScript, Tauri is replacing Electron and is popular nowadays, since Electron is very widely used. It seems Tauri cannot let Rust communicate with JavaScript very seamlessly yet, e.g. https://tauri.app/v1/guides/features/command/ seems to have mainly basic features. oneshtein mentioned below that Tauri does not support mobile as first class citizen yet as well. Looking forward to seeing Tauri's bridge to improve and supporting mobile better in the future!
reply
bubblebeard
28 days ago
[-]
Thanks for the info! I will keep an eye on this for future projects, keen to try it out. I’m currently working on a project being converted from Electron to Rust/Tauri. I recall Flutter being discussed, but our frontend dev was more comfortable with React.
reply
fzyzcjy
28 days ago
[-]
You are welcome and looking forward to it!
reply
bobajeff
28 days ago
[-]
From what I can tell. I've not used Tauri and it's been years since I've tried flutter.

Tauri currently has poor support for mobile and Linux (because of the state of WebkitGtk).

Flutter uses Dart which is not widely used for anything else. Harder to learn as there is no MDN, w3schools or standard spec for it. Also Flutter Web has issues due to it's use of Canvas over the DOM.

IMO, electron is still the way to go for cross platform apps.

reply
burakemir
28 days ago
[-]
Interesting! IIUC this is done using source-to-source translation? It is a bit hard to understand from the docs what technical approach is. The docs are clearly aimed at users and I find them impressive, well done. I'd be interested in knowing the approach and how it compares to wasm based Rust web frameworks before diving more deeply into it.

One advantage of combining Rust with Flutter seems to be that Flutter is a whole framework already and one would be able to share code and data structures between server and client side.

A comparison with other ways Rust

reply
fzyzcjy
28 days ago
[-]
Thanks! Shortly speaking, the Rust code is parsed (e.g. "here is a function and there is a struct"), and then some Rust and Flutter code are generated. As for comparison, some pros and cons are discussed in the blog.
reply
sbt567
28 days ago
[-]
Well done! I've heard only good things about rust_flutter_bridge. Some questions though (more like flutter question), how bloated flutter is (i.e. final app size) compared to mobile native (Java, Swift?) for simple app? And how's the UI performance looks like?
reply
fzyzcjy
28 days ago
[-]
For app size, it depends on your specific scenario, because e.g. Flutter automatically removes library code that is not used. I remembered (but the memory is blur) simple app has something like ~5MB. Btw remember to split .so file per abi. For UI performance, I personally find it quite good, and Flutter(Dart) is compiled to assembly code via AOT (instead of e.g. JIT or interpreted), which theoretically speaking is also fast. For both, I would suggest to make a demo for your specific case to have more accurate results. Also I guess ask/discuss on the Flutter community may help.
reply
BodyCulture
28 days ago
[-]
How is the a11y story with this? I did not find any info about it in the document, but I can not imagine anyone releasing a GUI kit in 2024 without extensive a11y support, so why not mention it?
reply
nsriv
28 days ago
[-]
Do you mean in Flutter generally? I'd say it's very good, easy to build in on widget by widget basis, very easy to check and rest when running builds.
reply
nu11ptr
28 days ago
[-]
I use Flutter for my desktop UI and Rust for my backend. However, I chose to separate the two using gRPC instead of the bridge. This allows me to be agnostic of language on both sides and I suspect gives me a cleaner interface for mocking the backend from my frontend. It also makes it easy to place the UI and backend on different machines giving a true client/server architecture. The con is likely that the interface is probably more verbose, however.
reply
nevi-me
28 days ago
[-]
Do you run a gRPC service on the desktop where the UI runs, and connect the 2 via localhost?
reply
duped
28 days ago
[-]
If you do this please don't use localhost, the socket domain for IPC is AF_UNIX not AF_INET. Even Windows supports it.
reply
nu11ptr
28 days ago
[-]
Then I would need two different mechanisms. Local and remote are both satisfied by TCP sockets, so this is easier.
reply
duped
27 days ago
[-]
It's not two different mechanisms, they are both sockets.
reply
mdhb
28 days ago
[-]
Not op but I’m developing an application with this exact approach as we speak, although my backend code is in Dart also.

You can also do gRPC over Unix domain sockets too if you’re sticking with desktop but overall I really like this approach as it makes it trivial for me to move from desktop app to web app with only some minor config changes.

reply
leononame
27 days ago
[-]
How is the dart backend story? I've not heard much about people using dart on the server, are there mature frameworks out there?
reply
mdhb
26 days ago
[-]
I love it personally and with gRPC I don’t really have much of a need for any kind of backend framework at all. I just follow the guidance at aip.dev and raw dog it using language primitives for the most part.
reply
nu11ptr
28 days ago
[-]
As one option, yes, the other option is to run them on different machines. App isn't done yet but the idea is that you are presented an option to either connect locally (if localhost detected) or remotely via auth on UI startup.
reply
pjmlp
28 days ago
[-]
Much better than reaching out to Chrome shells or Web widgets, kudos for the effort.
reply
fzyzcjy
28 days ago
[-]
Thank you!
reply
sydbarrett74
27 days ago
[-]
Does anyone know if Google plans to sunset the entire Flutter framework over time? Since they fired just about everybody internal who was working on it, I don't have a lot of confidence that Flutter will still have any Google support in 3-5 years. Has anyone talked about forking it and putting it under an independent foundation to ensure its long-term viability? Given Google's track record of long-term support for its various technologies, it would be a shame if Flutter got consigned to history's scrap-heap prematurely.
reply
satvikpendem
27 days ago
[-]
What? No one in the Flutter team got fired. The only ones who potentially had something to do with it were people on the Google Cloud team that ran the pipelines for Flutter builds, but even then, they didn't directly work on Flutter, and their roles just got outsourced anyway to Europe, so it's not like Flutter itself was actually affected.
reply
mdhb
27 days ago
[-]
What the fuck are you talking about? This literally never happened.
reply
danielvaughn
28 days ago
[-]
Nice, I really enjoyed Flutter's approach to building UI, but I didn't really care for Dart all that much.

In theory shouldn't it be possible to create a programming language specifically for UI? Something that can be interfaced with from any major programming language. Kinda like protobuf with its IDL format, but instead of defining data, it's declaring user interfaces. Is that a crazy or stupid idea?

QT and XAML come to mind, but I believe QT is closed source (might be wrong about that), and XAML seems to have been dead in the water for a long time now (also might be wrong about that).

reply
Tmpod
27 days ago
[-]
Qt has some commercial license only components, but the majority is open-source. In fact, the KDE Free Qt Foundation ensures that the framework is always available under GPL+LGPLv3.[0]

Anyway, there are some languages specifically desgined for making UIs. Qt has one of those, QML[1]. It's a "simple" language made precisely for UI development, that can be wired to C++, allowing you to write business logic in a general language, while keeping UI focused.

More interestingly, though, is Slint[2]. The language (and company behind it) was made by ex-QML devs which sought to improve the design, avoiding some pitfalls that QML ended up running into. It's core is written in Rust, but there are bindings for C++, JS and now Python too. They also have a focus on embedded devices, which ends up translating to always having good performance and memory footprint in mind, which is neat.

One of Slint's dev is ogoffart: https://news.ycombinator.com/user?id=ogoffart

[0]: https://www.qt.io/faq/tag/qt-open-source-licensing [1]: https://en.wikipedia.org/wiki/QML [2]: https://slint.dev

reply
danielvaughn
27 days ago
[-]
Wow slint is almost exactly what I was imagining, thanks!
reply
neonsunset
27 days ago
[-]
XAML is very much alive within Avalonia[0], Uno[1] and MAUI[2] (not to mention WPF) :)

There is support and growing popularity for declarative UI defined in C#[3] and F#[4] instead though.

[0]: https://docs.avaloniaui.net/docs/basics/user-interface/intro...

[1]: https://platform.uno/docs/articles/getting-started/counterap...

[2]: https://learn.microsoft.com/en-us/dotnet/maui/xaml/fundament...

[3]: https://github.com/AvaloniaUI/Avalonia.Markup.Declarative

[4]: https://github.com/fsprojects/Avalonia.FuncUI

reply
danielvaughn
27 days ago
[-]
Interesting!
reply
Zelphyr
28 days ago
[-]
I’m curious what you don’t like about Dart? I thought I wouldn’t like it but I’ve found it surprisingly nice.
reply
virtualwhys
27 days ago
[-]
Off the top of my head:

1) Types on the left

2) Statement, not expression, based

3) No privacy modifiers (aka, underscores everywhere)

4) required semicolons

5) no language support for json (de)serialization, or, json boilerplate everywhere (yikes)

I've tried to get into Flutter 3x now, and each time Dart has defeated me.

Flutter is quite good though, so take the good with the bad, I just can't stomach Dart (yet).

reply
satvikpendem
27 days ago
[-]
I've used lots of languages and those are fairly minor things. For example, I use Rust as well as Dart and just, "types on the left" is seriously an issue? In Dart 3 as well, many statements are now expressions, like switch and if/else, and in some cases, for. For something like JSON serde, Dart will have it soon via macros [0], just like Rust's serde macros. Sounds like you just need to build something you want to build and you'll get used to the language naturally. For me, the utility of Flutter and making cross platform apps outweighs Dart, and anyway, it is quite nice now with Dart 3.

[0] https://dart.dev/language/macros#use-the-macro

reply
danielvaughn
27 days ago
[-]
I don't have any well-considered opinions about it, moreso that on a gut level it felt like java or c#. It was a while ago that I tried it, and I can't recall the exact details.
reply
_bent
28 days ago
[-]
you mean CSS?
reply
danielvaughn
28 days ago
[-]
Kind of, but CSS is only 1/2 of a UI language, and it’s specific to the web.
reply
polyaniline
28 days ago
[-]
How does this compare to rinf?
reply
fzyzcjy
28 days ago
[-]
The first image at the bottom of that post may be related to your question: https://www.reddit.com/r/rust/comments/191b2to/rinf_copies_a... Btw, why is your name green?
reply
operator-name
28 days ago
[-]
Green usernames mean they're a new account! Here's a quote from the official FAQs:

> What do green usernames mean? > Green indicates a new account.

https://news.ycombinator.com/newsfaq.html

reply
fzyzcjy
28 days ago
[-]
Thank you!
reply
abound
28 days ago
[-]
And then there's also crux [1], which is the same "write your mobile app business logic once in Rust", but instead of Flutter, integrates directly with native iOS/Android/Web UIs

[1] https://redbadger.github.io/crux/

reply
fzyzcjy
28 days ago
[-]
Yes, if someone needs to write UI using native Android/iOS code, Crux would be suitable. On the other hand, personally speaking, I prefer to write all code 1 time, but Crux seems to require to write the UI code 3 times for Android+iOS+Web.
reply
oneshtein
28 days ago
[-]
Tauri supports mobile platforms too. Sadly, it's not a first class citizen in Tauri 2.0 as promised.

I tried both Flutter and Tauri. IMHO: Tauri is better, because it allows me to use existing web frameworks (or even plain Markdown + Pandoc!), to make web-pages, while handling business logic in type safe Rust.

reply
fzyzcjy
28 days ago
[-]
Thanks for the information, and I replied bubblebeard above about Tauri.
reply
itohihiyt
28 days ago
[-]
Isn't Dart type safe?
reply
oneshtein
28 days ago
[-]
Dart is order of magnitude slower than Rust.
reply
mdhb
28 days ago
[-]
If you’re doing some super intensive data processing or have specialist use cases then yeah, sure feel free to write that part in Rust, C or whatever you like.

That’s literally what this package is about. Unlocking that use case for you although Dart also has bindings for Go, Java, Kotlin, C, and Swift so you can take your pick.

But the reality is that Dart compiles down to native code on all platforms and is not going to be slower in any way that actually matters or is noticeable to users in the vast vast vast majority of scenarios and the productivity hit you take from moving to Rust or C from Dart is also an order of magnitude slower.

reply
itohihiyt
28 days ago
[-]
I wasn't trying to be argumentative, and certainly rust is faster than dart, but if type safety is your main concern Dart/Flutter is less convoluted/complicated than rust+web frontend. In my opinion, obviously.
reply
satvikpendem
27 days ago
[-]
Note that the linked thread by OP has now been resolved and the rinf author fixed and apologized [0]. This thread might be a better start on the differences [1].

[0] https://github.com/cunarist/rinf-status-report

[1] https://www.reddit.com/r/FlutterDev/comments/1dnwagk/flutter...

reply
j-krieger
28 days ago
[-]
Flutter Rust Bridge is without a doubt the best FFI bridge I‘ve ever used. It works like magic. I have no idea how it‘s done.
reply
fzyzcjy
28 days ago
[-]
Thank you!
reply
the__alchemist
26 days ago
[-]
Does anyone know how this compares to EGUI in terms of performance, binary size, flexibility, and overall experience?
reply
api
27 days ago
[-]
The sample with Google's IMHO ugly material design plus confetti is not the best look.
reply
webprofusion
28 days ago
[-]
Cool, but the point of having stuff in Rust is to ideally have everything in Rust, or you're by definition not getting all the safety benefits of Rust.
reply
jenadine
28 days ago
[-]
Dart is also safe.
reply
ramon156
28 days ago
[-]
While dart is definitely not like rust, dart is a very safe language. I'd love a dart+rust project if the package ecosystem wasn't such a mess in dart
reply
mtizim
28 days ago
[-]
Not at all, pretty much all popular languages (except C/C++) are as safe as (safe) rust. The only safety rust brings to the table is memory safety, which most languages achieve with a runtime and a garbage collector, which have a performance tradeoff.
reply
wongarsu
28 days ago
[-]
In three most narrow definition of safety I agree. But that's a very narrow definition. Rust does offer a lot more:

- no undefined behavior

- many classes of concurrency bugs prevented by the type system

- standard library and much of the ecosystem makes invalid states unrepresentable. E.g. a String is always valid UTF8

Those are things that are true to varying degrees for other languages. Dart does pretty well imho. But for example Java and C# offer memory safety but have very unsafe concurrency

reply
pjmlp
28 days ago
[-]
Rust's concurrency is only safe in the very specific use case of threads trying to access common resources on the same memory space.

It does nothing to prevent data races between processes, or concurrency errors between threads accessing resources that are external to the process.

Scenarios quite relevant in distributed systems.

reply
taneq
27 days ago
[-]
A bulletproof vest doesn't stop you getting stabbed, it still makes you safer though.
reply
pjmlp
27 days ago
[-]
Unless it is a skilled shoter doing an head shot, or using high caliber ammunition.

I do agree it helps, but it isn't the improvement over other memory safe languages, that the Rust Evagelism Strike Force makes it to be.

reply
p_l
27 days ago
[-]
Or you have "standard" vest (without ceramic armor plates) and the shooter shelled out for handgun designed for (and with) armor-piercing ammo or PDW-class gun or higher powered cartridge in a full rifle.. etc ;)
reply
CryZe
28 days ago
[-]
You definitely also get a lot more thread safety out of Rust than most languages.
reply
jurschreuder
28 days ago
[-]
Isn't Flutter basically a way to use the C++ render engine from Chrome, with a "scripting" language most similar to Kotlin and Swift?

Why not just use the Chrome render engine directly from Rust?

Why all the extra steps?

reply
imadj
28 days ago
[-]
> Why not just use the Chrome render engine directly from Rust?

This is what projects like Tauri (in Rust) and Wails (in Go) are doing[0][1]. Utilizing Webview to develop applications, but they still don't support mobile, Tauri mobile is in beta.

Basically Tauri and Wails are on one side (HTML/CSS) trying to approach cross platform by supporting mobile platforms, while Flutter and Kotlin Compose Multiplatform started from the other side.

So it depends on your needs, web-first or mobile-first, and what platforms matter to you. So far Flutter is in the lead offering the most polished experience when it comes to supporting all platforms (Web, desktop, iOS, Android).

[0] https://github.com/tauri-apps/tauri

[1] https://github.com/wailsapp/wails

reply
ThePhysicist
28 days ago
[-]
They used to be based on Skia but now they have their own renderer (Impeller). That said rendering is only a small part of a UI toolkit, there's a ton of other stuff e.g. how to interact with system libraries, integrate with UI paradigms (e.g. tray icons, gestures, responsiveness, widgets).
reply
polyaniline
28 days ago
[-]
There's too much infrastructure on top of the render engine to replicate. Flutter is backed by Google and has a fairly large ecosystem of community packages.

See Freya - which uses Skia - the render engine Flutter used until a while back.

reply