Hacker News new | past | comments | ask | show | jobs | submit login

> I just wish Google had built Flutter on a low level core that isn't tied to Dart, so it would be usable from other languages.

Any chance that someone will build a transpiler from e.g. Go or even Rust to Dart? Or is Dart too exotic to be used like that in a practical way?




Flutter and Dart have co-evolved to the extent that separating them would be difficult.

One problem would be expressing the Flutter API as a Go API. For example, Flutter has lots of constructors with lots of keyword arguments. Flutter is doing things with keyword arguments that would be expressed as props in a React-style UI. A similar thing happened with JavaScript and JSX - while you can write a React-style UI without JSX, you probably wouldn't want to.

Maybe you could define props using structs in Go, but the result would be awkward, particularly because Go doesn't have an easy way to bulk-copy fields from one struct to another, like you do with spread arguments in JavaScript.

Also consider that Flutter uses class hierarchies extensively and Go doesn't have inheritance.

Maybe look at how web development is done in Go when it's compiled to WebAssembly. Is that how you'd want to do web dev?


> Go doesn't have an easy way to bulk-copy fields from one struct to another

FYI, In Go you can embed one struct in another and the embedded fields are accessible from the top/parent struct.

https://go.dev/doc/effective_go#embedding




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: