dart-lang / site-www

Source for Dart website
https://dart.dev
Other
968 stars 696 forks source link

Update `dart:developer` support note on 'Core libraries' #5107

Open parlough opened 1 year ago

parlough commented 1 year ago

Page URL

https://dart.dev/guides/libraries/index

Page source

https://github.com/dart-lang/site-www/tree/main/src/_guides/libraries/index.md

Describe the problem

The dart:developer note mentions that only Dart VM JIT and the web development compiler (previously dartdevc) support the API. However, I believe that has changed slightly, perhaps earlier, but at least in Dart 3.2 (https://github.com/dart-lang/sdk/commit/af8fb2cd73c3b5ec96a39c59e85f470efe78d8a4). Other platforms may support the library to a certain extent as well.

Expected fix

Determine each platform's support for the library, and update the note for that.

We should consider expanded docs for dart:developer APIs and how to use them to accomplish certain tasks as well.

Additional context

No response

parlough commented 1 year ago

I will wait until after the 3.2 beta cut-off to investigate this further as other changes may be made before that point.

parlough commented 11 months ago

@bkonyi Would you be able to help me understand what works in dart:developer on what platforms/modes? Let me know if I should redirect this query elsewhere :) Thanks!

bkonyi commented 11 months ago

I'll do my best :) cc @elliette to confirm the web side of things.

Unless otherwise specified, "VM" implies Dart and Flutter native. The standalone VM is the dart runtime. "non-PRODUCT mode" means an embedded VM built with either DEBUG or RELEASE defined. Only Flutter "release" builds use PRODUCT.

dart2js doesn't support any of these APIs, and I didn't mention dart2wasm anywhere since I'm not exactly sure what the support looks like on that end. I assume dart2wasm will have the same support as either dartdevc or dart2js.

Note that none of these APIs will throw exceptions or cause crashes if they're executed on unsupported configurations, but will either be no-ops or simply return default values.

parlough commented 11 months ago

Wow thanks @bkonyi! I didn't expect that much detail and explanation, but how you outlined everything was perfect. It will be extremely helpful for @MaryaBelanger and I!