by offtop5 · 5y ago · 0 comments
Dart makes Typescript look like a joke. The build system alone makes flutter better than React Native !
I'm confident in being able to build any CRUD app in dart
Edit, in fact how many of you have actually built a project in flutter .I can't believe anyone would want to go back to react native after trying it
Like with Unity, the power of cross-platform development leads many to just assume apps work across platforms automatically. This is absolutely not the case, you need to properly QA any code you write and code it to accommodate each platform's quirks.
I would not buy a screwdriver if a salesperson walked up to me, said "look how great this screwdriver is" and then the chair they were holding as an example immediately fell apart in their hands. There's a difference between a dev community building apps that perform badly and the actual platform advocates showing off apps that can't perform.
All the Flutter demos I've seen today are saying "Do you want your app to, at best, take a long time or even fail to load, feel like scrolling through molasses, break when you click a button, and spin text around at 25 fps like a 2005 Flash animation? Well, have we got a framework for you!"
I haven't seen one.
I like Flutter, but I don't think the Flutter Web design is very viable for production apps. It renders everything in canvas. Dart is already sluggish on native, and cross compiled to JS it's usually unusable.
I think Flutter will be a good choice for mobile and Desktop soon-ish, but for web ... maybe in a few years. Maybe.
ps: for me the Gallery is extremely laggy in Firefox, but works decently well on Chrome. Maybe wasm is enabled on Chrome only.
I strongly disagree re: Dart vs. TS, but then, I was a JS dev before I worked with Dart/Flutter, so probably a bit biased. But I think that is a very subjective statement, not objective.
I am really hopeful for it and am going to keep using on it for hybrid apps.
I try to just tell devs to try it, then judge it. Because it does seem weird up front, but it is such a nice experience for devs and can make great mobile apps.
Dart still does not even have union types, probably the best feature of TS. I would hold off on that claim for now..
But for me the main use for TS union types is to make discriminated unions, which is very useful wherever you have some form of a state-machine:
type AppState =
| { state: "loading", progress: number }
| { state: "selecting_level", }
| { state: "playing", level: Level }
| { state: "success" }
| { state: "failure", wantsRetry: boolean }
| { state: "error", reason: string }
(Small excerpt from a game we're developing at $dayjob)You can switch on that and the compiler will know what variant you're talking about, and it will apply exhaustiveness checks (ensures your code will handle all possible states)
abstract class AppState {}
class AppLoading extends AppState {
final int progress;
}
class AppSelectingLevel extends AppState {}
class AppPlaying extends AppState {
final Level level;
}
...
Certainly not as neat, but also, not that far off either. Then where you use this app state, you could switch over its `runtimeType`, and in each clause, the IDE will understand which implementation you are dealing with, and actually give you context sensitive help related to that particular state.If you instead only cared about one case, you would be able to do:
if (appState is AppPlaying) {
doSomething(appState.level);
}
Would this be somewhat analogous to the functionality you get with unions in typescript?But, in practice, a language's type system tends to optimize for the data structures that are idiomatic in the language. TypeScript is a heavily structural type system because idiomatic JavaScript often throws together unrelated types in this way (which makes sense when you're coming from dynamic types).
In a language that is built more strongly on objects and static types, it's less common to see APIs that "return one of these, or one of these, or on Sunday one of these things". So there is relatively less use for union types.
In other words, because people express unions at runtime less frequently in Dart (and other languages like Java and C#), there's less value in supporting them statically. Still some, definitely, but I don't think it's as critical of an omission as you might expect coming from TS/JS.
Big part of it is thanks to the community which is providing all the handy packages to add some native stuff easier (such as permission, localization etc.)
I agree with other comments that Flutter Web is not ready yet I've tried to build web version for wish list sharing based on Flutter and I was struggling, so in the end I've switched to Tailwind + Vue. Some issues I had was that website didn't behave like website. For example I couldn't select text with my mouse. It felt and behaved more like a mobile app through the browser.
For mobile though it works (almost) perfectly, my example of the mobile iOS and android app build with Flutter: https://wishpy.com/
Although it loads a bit long at the beginning and I still need to figure out how to show images and icons without an uncomfortable glitch at the screen start.