dint-dev / universal_html

Cross-platform 'dart:html'.
https://pub.dev/packages/universal_html
Apache License 2.0
201 stars 63 forks source link

Why were js.dart and others deprecated? #20

Closed dannnnthemannnn closed 4 years ago

dannnnthemannnn commented 4 years ago

Is there a better solution than using this package for those?

terrier989 commented 4 years ago

Hi!

Thanks for the issue report! :) They libraries were originally added because 'dart:html' APIs had some references to dart:svg, etc. However, it became apparent that some Flutter developers are using _package:universalhtml for purposes the package was not designed for. The aim of the deprecation was to save those developers' time by discouraging people from using _package:universalhtml incorrectly.

Developers dealing with Javascript libraries should use pub.dev/packages/js, which is the official package by Google and is much easier to use than dart:js. Cross-platform Flutter code can be achieved with conditional imports/exports.