Live data from Hacker News

Dart/Flutter now has macros/metaprogramming

github.com

101–110 of 129 posts

Re: Dart/Flutter now has macros/metaprogramming

#101

Earlier quoted context omitted.

You might find the following two reddit threads enlightening, as they talk about Flutter's verbosity: https://www.reddit.com/r/FlutterDev/s/kKVzkvpnlj https://www.reddit.com/r/FlutterDev/s/RyBQaLBeuS Tldr, it's a different philosophy between Flutter and Swift, of explicit being more useful that implicit, and of performance optimizations that can be made due to that. The second thread has the tech lead of Flutter resp…

Thanks for the good reads and your TLDR. I believe there are very good reasons to design Flutter as it is and I don’t want to denigrate it. I think it is awesome work. It is just that Swift feels extremely elegant and well-shaped, like a Domain Specific Language, and it didn’t feel this in the beginning. It evolved and did a great job. Maybe like Java and Kotlin. I like Java after all, however I enjoy Kotlin the way…

Actually, check out this comment [0] I made in another thread that was recently posted (copy pasted below), it's about Compose Multiplatform in Kotlin, it seems to be an upcoming Flutter competitor. It's pretty intriuging as I was initially using Flutter because I didn't want to have different apps for each platform, but it seems like with CM, it can do the same thing as Flutter but with more advantages, as I wrote of below.

[0] https://reddit.com/r/FlutterDev/comments/1afeo2r/has_anyone_...

---

Something I thought was really interesting in Compose Multiplatform is that you can transparently use both platform views and CM views together in a way that I haven't seen in Flutter.

I just watched that video [0] as well and I wanted to highlight a few interesting concepts there. Check out the timestamp 41:37 where they talk about the above interoperability. They have an example of a messenger app where the messages are in CM while the text input box is in Swift, so that this ensures that you are not reimplementing the native text editing controls as Flutter does, so I see that as a clear advantage for specific things like that. I don't believe that is quite possible in Flutter, or am I mistaken?

Also see timestamp 51:23 where they talk about graceful decomposition where if you decide to remove CM, you are left with a regular Android app as CM is backwards compatible with Jetpack Compose. It looks like CM can both paint to the screen but also fall back to using pure native Android components.

The way the architecture of CM is set up seems to make CM quite robust. Initially, I wrote off Kotlin Multiplatform because I thought, what's the point of sharing business logic in Kotlin if I still have to write the UI twice for mobile, not to mention for the other platforms like web and desktop. But now with CM, it looks like they're directly addressing Flutter to the point of taking a lot of concepts from it like you mentioned, like painting pixels on the screen (but optionally falling back to native views), or using WASM and canvas for the web which is exactly what Flutter Web does too.

I use Flutter quite a bit but it seems like Compose Multiplatform might be the future, or at least a big competitor, due to Google focusing more on Android dev and the whole Kotlin ecosystem in the past few years, it seems. The only con right now seems to be that CM is way less mature than Flutter, which really reminds me of where Flutter was several years ago.

[0] https://www.youtube.com/watch?v=IGuVIRZzVTk

Re: Dart/Flutter now has macros/metaprogramming

#102
post #85

Earlier quoted context omitted.

I'm working on an app that is running on the latest version of Flutter with Impeller enabled. The performance seems good as long as you do not embed platform views inside a list. However, when you drop even a single platform view (web view, video player, google ads...), the performance drops to unacceptable levels even on the latest iOS devices. This is related to another issue with the Flutter ecosystem, it has clos…

You might be interested in Compose Multiplatform, it's from JetBrains and is a combination of Jetpack Compose and Kotlin Multiplatform. You can transparently use both platform views and CM views together in a way that I haven't seen in Flutter. Here is a video about this where the JetBrains employees go over a demo of building a cross platform app in 100% Kotlin, just as would be the case with Flutter [0]. Check out…

That Compose Multiplatform interoperability with the native views and other way around looks really nice, especially because it matches how SwiftUI deals with UIKit/AppKit interop. However, at this point it is hard to say if they will hit very similar performance issues that Flutter deals with as rest of the UI is not native and is drawn with Skia (as done by Flutter before it moved to Impeller for improved performance). It is definitely very valuable feature nonetheless.

Re: Dart/Flutter now has macros/metaprogramming

#103
post #102

Earlier quoted context omitted.

You might be interested in Compose Multiplatform, it's from JetBrains and is a combination of Jetpack Compose and Kotlin Multiplatform. You can transparently use both platform views and CM views together in a way that I haven't seen in Flutter. Here is a video about this where the JetBrains employees go over a demo of building a cross platform app in 100% Kotlin, just as would be the case with Flutter [0]. Check out…

That Compose Multiplatform interoperability with the native views and other way around looks really nice, especially because it matches how SwiftUI deals with UIKit/AppKit interop. However, at this point it is hard to say if they will hit very similar performance issues that Flutter deals with as rest of the UI is not native and is drawn with Skia (as done by Flutter before it moved to Impeller for improved performan…

Yeah it might be that JetBrains will eventually realize and move to Impeller or write their own renderer like Rive.app has done for their use case.

Re: Dart/Flutter now has macros/metaprogramming

#104

After years of working in Typescript I've been doing a Dart project for the last 6 months or so. Overall it's a great language but one of the clunky aspects is the use of code generation for so many things. If this can reduce or even eliminate that it will be a big step forward for devX.

> one of the clunky aspects is the use of code generation

Yeah, I’ve been trying to stay away from it but it feels inevitable!

I do not want to deal with code generation.

Re: Dart/Flutter now has macros/metaprogramming

#105

Dart is to Flutter what Ruby is to Rails. Less actually. Is Flutter still just rendering everything to a as an image? Why not a “Plutter” framework using Python instead of Dart and outputting a WASM app that uses Flutter for all the layout?

> Is Flutter still just rendering everything to a as an image?

No, it can spit out html instead.

Re: Dart/Flutter now has macros/metaprogramming

#107

After years of working in Typescript I've been doing a Dart project for the last 6 months or so. Overall it's a great language but one of the clunky aspects is the use of code generation for so many things. If this can reduce or even eliminate that it will be a big step forward for devX.

> one of the clunky aspects is the use of code generation Yeah, I’ve been trying to stay away from it but it feels inevitable! I do not want to deal with code generation.

It's not a big deal in practice but it would be nice if it wasn't necessary.

Re: Dart/Flutter now has macros/metaprogramming

#108

Would it be wiser if the Dart team and the Flutter team split up and let the Dart language grow outside the Flutter ecosystem? Because the only use case I see with Dart is UI development, nothing else.

Flutter is what rescued Dart from certain death, after Chrome stop caring and AdWords took over from what was left in Dart 1.0, as most well know language designers on the team like Gilad Bracha and Kasper Lund left Google.

Re: Dart/Flutter now has macros/metaprogramming

#109
post #33

Earlier quoted context omitted.

>Why would I use it over something like Rust, Go, or even JavaScript? Honestly, mainly for flutter. But if you do chose flutter for your project, you will suddenly wish everyone was using dart for everything else instead of Java on android, or c#/Swift on ios ect. if that makes sense. If sound type checking is truly feasible on the web then I'd say dart should be there too. But I can't say if that's really the case.…

I think Dart really suffered from missteps in the early days. Originally, Dart didn't seem like anything special and it kinda wasn't. It was a dynamic language where optional type hints were suggestions and it'd be run in a VM just like JS and seemed like JS with some slight differences. It feels like Dart became a completely different language that just happens to have the same name. It's now statically typed, has A…

[deleted]

Re: Dart/Flutter now has macros/metaprogramming

#110
post #83

Earlier quoted context omitted.

Most likely they’re not using the new impeller rendering engine. My flutter app is very smooth on iOS and I didn’t have to put in any fancy hacks to make it that way.

Flutter apps have god awful performance when there is even a single platform view on the screen. In effect this means that if the app is monetized by ads, have any video, map embed or anything of the sort, it will have sub-30fps and very janky scroll even on iPhone 15 Pro and it really seems that there is no hacks to save you.

That hasn’t been true for over a year maybe two at this point.
Post reply on HN