Also I'm so glad to see that updated long term vision for Dart. I've argued for a while now that it was more constrained than it should be and it was overlooked in a lot of use cases where it was actually a great language choice (i.e I write and run a bunch of cloud native backend services using Dart gRPC and Cloud Run and to me it's one of the best kept secrets about the language). Seeing that public commitment from the team is a big deal and much appreciated.
I associate Medium with small corporations and individuals with an ever-so-slightly scammy hustler vibe, not big corps.
I’ve been working with state charts a lot and being able to target multiple platforms with the same code would make what I’m doing so much more useful. This library seems to support everything I need: https://github.com/rows/automata
Maybe a good side project! Can anyone give reasons why someone should/shouldn’t write Dart (besides a smaller ecosystem)?
Honestly, I think it’s just because the language is a solution in search of a problem. It doesn’t do anything significantly better than any other language and so there’s no reason for it to get traction.
I agree it’s pretty decent though, it could have been what Typescript has become but it failed for some reason.
There was clearly a time where Google could have, and should have, killed it, but instead they decided to keep it alive and make it a core part of Flutter (Lord knows what internal politics lead to this decision). It appears that since then, just like Golang, Google has decided to plough incredible resources into turning a bad language into an OKish one. Meanwhile the world moves on.
The flutter site contains a very unconvincing explanation of why it uses Dart [1]. Unconvincing in the sense that the reasons given do not add up to a reason why a very niche language should be kept alive when many other languages would do just fine (Kotlin seems like the most obvious choice).
[1] https://docs.flutter.dev/resources/faq#why-did-flutter-choos...
A huge amount has changed since then.
Had it not been for Ad Words team, Dart wouldn't have been used for Flutter.
That is about to change however examples here https://youtu.be/yRlwOdCK7Ho 28:30 mark)
But the fact that unlike Typescript it will now also natively target WASM along with the fact that it’s generally a much more pleasant language to use I hope it starts to get much more serious consideration moving forward.
Simple example here looking at Mixins (a fairly basic pattern to describe any kind of a “is-a” rather than a “has-a” relationship in OOP).
Here’s TypeScript
https://media.infosec.exchange/infosecmediaeu/media_attachme...
Here’s Dart https://media.infosec.exchange/infosecmediaeu/media_attachme...
But it doesn't explain what js.window IS. I assume it's implemented via static interop (https://pub.dev/packages/js#staticinterop), but not sure.
Is it out of some secret library they have somewhere, generated from Web IDL? Do I have to implement every function/property on window myself via static interop?
Btw, you can link to youtube with a timestamp: https://youtu.be/yRlwOdCK7Ho?t=1724
Update: I did find this package, which seems to generate bindings from Web IDL: https://pub.dev/packages/js_bindings, but it's not from the Dart team, and prob not what they're using here.
Around that time Google launched a few “initiatives” to build a “better and more efficient” web. AMP was later but the same spirit and of course all of this was a dystopian nightmare so people got scared and mostly ignored Google.
Dart only exists today as an actively developed language because of Flutter.
BTW, all the negative comments I see here seem to come from people who haven't worked with Dart and Flutter which is a cultish reactive showing of `google meh` `apple cool!` sentiment that permeates HN.
If you haven't tried Flutter and Dart give it a good try, it is really nice.
I’m sure the initial reasons for their state management were valid and their heart was pure, but god damn it’s a mess.
It mostly extends from the fact that the Flutter community in general is stuck on a perpetual loop talking about it because there is no “one true way blessed by Google wrapped up into a single package that is appropriate for all use cases”.
But in practice it’s exactly the same as any other OOP language or framework where you can pick from multiple paradigms depending on your use case.
Want to use a state machine? There are options for that. Same goes for Rx patterns, local state, redux patterns and more.
There are a lot of extremely complicated apps who don’t have any issue with it in reality and the drama is very much a community problem rather than a real issue.
The GUI components would be aware when their state changed and would update its own display. But now you can't do that anymore - either you redraw the whole screen or not at all.
You could receive/send data asynchronously if needed in a separate thread and update the main thread which managed the GUI etc. None of this required jumping through hoops like we are doing now.
Example: This is how data could be fetched asynchronously and the UI updated on termination of the call in Delphi:
procedure TMainForm.ButtonClick(Sender: TObject);
begin
RESTRequest.ExecuteAsync(
procedure
begin
Memo.Lines.Add(RESTResponse.Content);
end,
True, True,
procedure(Error: TObject)
begin
Memo.Lines.Add(Exception(Error).Message);
end;
end;Note: even with all of the Pascal ceremony of begin/end etc, this code is more succinct and far cleaner and much easier to debug than the state/stateless nonsense that is spread out all over a Flutter codebase.
And yes, I do remember that Visual C++ had a bit of a convoluted state management logic for MFC.
The existence of the Stateless vs Stateful widgets, the "class YourState extends State<>" classes, you can't put a stateful widget inside a stateless widget and a range of many other things that aren't at the top of my mind right now.
Of course that are valid reasons of all of this, of course there are "other better ways", but when a large part of your user base wrestles with this for years, it really doesn't matter how smart and correct you are because it is in fact a problem.
def main(page: ft.Page): page.title = "Flet counter example" page.vertical_alignment = ft.MainAxisAlignment.CENTER
txt_number = ft.TextField(value="0", text_align=ft.TextAlign.RIGHT, width=100)
def minus_click(e):
txt_number.value = str(int(txt_number.value) - 1)
page.update()
def plus_click(e):
txt_number.value = str(int(txt_number.value) + 1)
page.update()
page.add(
ft.Row(
[
ft.IconButton(ft.icons.REMOVE, on_click=minus_click),
txt_number,
ft.IconButton(ft.icons.ADD, on_click=plus_click),
],
alignment=ft.MainAxisAlignment.CENTER,
)
)