3 ms·
Historically there was always a bit of a funky story about what JS <-> Dart interop looked like that made it not a particularly practical option for most people
by mhoad 3y ago
Historically there was always a bit of a funky story about what JS <-> Dart interop looked like that made it not a particularly practical option for most people.
That is about to change however examples here https://youtu.be/yRlwOdCK7Ho 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_attachments/files/110/267/005/251/685/190/original/6cd93343daba7402.jpeg https://media.infosec.exchange/infosecmediaeu/media_attachme...
Here’s Dart
https://media.infosec.exchange/infosecmediaeu/media_attachments/files/110/267/005/250/857/204/original/2a45b0723405c06d.jpeg https://media.infosec.exchange/infosecmediaeu/media_attachme...
- markdog12 3y ago> That is about to change however examples here https://youtu.be/yRlwOdCK7Ho https://youtu.be/yRlwOdCK7Ho 28:30 mark) But it doesn't explain what js.window IS. I assume it's implemented via static interop (https://pub.dev/packages/js#staticinterop 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 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 https://pub.dev/packages/js_bindings, but it's not from the Dart team, and prob not what they're using here.
- mhoad 3y agoWork on that is happening here https://github.com/dart-lang/web https://github.com/dart-lang/web. I expect it will be fully baked by the time Dart 3.1 drops and in-line classes are a thing as it ends up making a big difference as far as I can tell.