dart-pad icon indicating copy to clipboard operation
dart-pad copied to clipboard

Support for `dart:web_gl`

Open RedBrogdon opened this issue 2 years ago • 9 comments

I cannot remember if we've discussed this particular library or not over the last few months, but I got a question from @slightfoot about whether we could support dart:web_gl. He's been doing some incredible 3D demos of late, so it'd be cool if we could host them here.

RedBrogdon avatar Feb 19 '22 22:02 RedBrogdon

The dart:web_gl package is allowed by the import filters: https://github.com/dart-lang/dart-services/blob/master/lib/src/project.dart#L145

Does someone have a small web_gl sample that works on the desktop? My google searches keep turning up code from Dart 1 days...

domesticmouse avatar Feb 20 '22 04:02 domesticmouse

@RedBrogdon @domesticmouse Created a gist sample and it actually runs if you press the RUN button. But it shows lots of syntax errors in the dartpad editor and says it can't import it. So perhaps this is an issue on the front-end / analysis server.

https://dartpad.dev/4a2c9f33ea9668770d1cbbf8cedcb473

slightfoot avatar Feb 20 '22 18:02 slightfoot

@srawlins do we need to reconfigure the analysis server?

domesticmouse avatar Feb 20 '22 23:02 domesticmouse

I haven't had a chance to look at the dart-services logic yet, but:

It seems most of the web libraries besides dart:html, dart:js, and dart:js_util are not supported. I don't know much about it but I believe the Flutter/Dart SDK does not support the other web libraries(web_ql, web_audio, etc) when a dependency on Flutter is included.

dart-services may be improperly analyzing this file with the Flutter project analysis server instead of the Dart project based one or the Dart one is misconfigured.

parlough avatar Feb 21 '22 03:02 parlough

Curious, it looks as though we should already:

https://github.com/dart-lang/dart-services/blob/061e9b4e1422b17592f71966bb2416ed24f2aac3/lib/src/project.dart#L145

srawlins avatar Feb 22 '22 21:02 srawlins

I'm updating this to p1 as this is a bug with the previously supported functionality of proper analysis around core SDK libraries.

parlough avatar Feb 26 '22 10:02 parlough

From an initial investigation, the Dart project analysis server is being used, but it looks like certain packages are causing the issue. It seems any of the packages which have a dependency on Flutter pull in various Flutter dependencies into package_config.json disabling analyzer support for most web based SDK libraries including dart:web_gl.

So it seems we are improperly including some dependencies which don't support the Dart SDK. I've removed some of them in https://github.com/dart-lang/dart-services/pull/831 but it seems the Firebase packages are causing issues as well.

parlough avatar Feb 26 '22 11:02 parlough

@domesticmouse looks like this still is a problem. any news?

slightfoot avatar Jun 06 '22 11:06 slightfoot

I'm unsure what the required fix is. More than happy to accept PRs on this one.

domesticmouse avatar Jun 06 '22 11:06 domesticmouse

I'm going to close this as dart:html and friends (including dart:web_gl) are now legacy, and support for them in DartPad is now deprecated and limited. So I don't think we'll be able to spend the time to get the library working.

Consider migrating to package:web and package:js_interop for any interaction with DOM/browser libraries, both in DartPad or elsewhere. https://dart.dev/go/next-gen-js-interop has some more details :)

Thanks! And sorry we weren't able to resolve this earlier.

parlough avatar Feb 18 '24 03:02 parlough