Hacker News new | ask | show | jobs
by armchairhacker 878 days ago
I hope Dart gets more support, I really want alternatives to TypeScript for developing webapps which aren't super "bulky" (slow startup, buggy and hard to debug) and support mobile apps. Dart seems to be the best at both although I haven't used it much. It also seems reasonable (one of the reasons I don't like TypeScript is because it still has some quirks from JavaScript like `===`, also because the types are occasionally wrong even in strict mode).
6 comments

Isn't flutter the anti thesis of that? Making performant JavaScript apps is much much easier than making a performant flutter or especially flutter web app
I have an opposite experience. Making performant JavaScript app require years of learning hacks of web ecosystem. Which is unsurprising, given that web apps build on the foundation layer not suited for performant UI apps. Flutter apps are performant out of the box, because, well, it was designed with this goal in mind.
No idea if it's any better on Android, but on iOS I can recognize a Flutter app within seconds, by the frame rate on a new iPhone dropping to something I haven't seen on any mobile device (iOS or Android!) since the Android 2.2 days on extremely underpowered Qualcomm chips.
On Android, Flutter apps are typically even faster than native on cheap low-end devices from my experience. I'm comparing using a Galaxy J3 pro and the difference is visible in favor of Flutter. On high-end devices, I don't see any difference.

That's also one of the reason why the framework is so popular in developing countries.

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.
Yep, my typical experience with flutter apps is having way more frame drops, and occasional bugs which lock up the entire UI and require an app restart. Thankfully I think google is moving towards just using the platform UI for most apps, though I can't remember where I read that so take it with a grain of salt.
You can use dart without flutter.
Absolutely, but for webapps, is there any other options using dart? For the record, dart is one of my favorite languages. I'm just a bit sad that it is more or less tied to flutter (not by design, just because it's the main usage it gets)
Jaspr is one such framework, it is written similarly to Flutter but it instead outputs HTML, CSS and JS.
They are a couple of weeks away from launching a major rewrite of Web support.

Historically it was clunky and weird.

Now it’s able to use the exact same Web APIs that you’re already used to but now in a type safe way and much much better type safety guarantees that Typescript provides.

Example code here: https://github.com/dart-lang/web/blob/main/example/example.d...

How do you feel about Java? How about Ruby? (If you have worked with those). I'm mainly asking so I have a baseline for what your preferences are. Considered Dart in the past but haven't tried yet
I dislike ruby, purely as a matter of personal preference. As a baseline, python is probably as "dynamic" as I can tolerate, and java I just don't have enough experience with sadly enough. I use mostly c++/go/python with some julia and rust (not enough to have tons of experience with it though!). I'd day try dart, it's very easy to pick up. In some odd ways it reminds me of swift!
thank you!
> I really want alternatives to TypeScript for developing webapps which aren't super "bulky"

I hear you, but what do you expect Dart's contribution as a language/technology to be in this space, effectively? While syntactically comparable, TypeScript is a better typed JavaScript than Dart will probably ever be (in terms of leveraging a type system to enable more complex/maintainable apps and libraries). And since every programming language compiles to JavaScript these days, you've got some compelling options if you really want to depart from JS altogether (with http://www.scala-js.org/ an amazing one, for which I find the mix of Functional + Object Orientation to lend itself very well to the web).

In all, I really fail to see a good reason for Dart to exist nowadays (and surviving as "Flutter's best language buddy" isn't a great one).

> TypeScript is a better typed JavaScript than Dart will probably ever be

At the same time, thank goodness Dart doesn't have all the warts of Javascript and a standard sane build system. Dart doesn't have to be the best Javascript to be good at what it does, especially now with algebraic data types and pattern matching.

I'm hopeful they'll make Wasm production-ready soon to move away from JS transpilation.

> webapps which aren't super "bulky" (slow startup, buggy and hard to debug)

All good things.

Hot take to think Dart is superior in that respect.

As hot of a take is that macros and meta programming are going to make startup and code bloat better
That's clearly not what armchairhacker was claiming.
I did a little programming in dart. There are many things to like. And I believe, at the time of writing, that Dart really is great for both java and js devs. Every object that is used has to be an instance of a class, and the event-driven style for reactive programming is pretty much 1:1 to how js does it. So it truly could become the sweet spot for UI development that is appealing to both types of devs.

I just wished it would have native tuples.

It does have tuples. They're called records in Dart: https://dart.dev/language/records

Also "destructuring" via patterns: https://dart.dev/language/patterns

Dart also deserves alternative UI frameworks. With varying combinations of native controls usage and imperative-ness.
ClojureScript has a pretty good story there but of course not statically typed. There are some good libraries if you want more checking.