analytics_flutter icon indicating copy to clipboard operation
analytics_flutter copied to clipboard

Upgrade JS interop by removing dart:html dependency

Open maxlapides opened this issue 1 year ago • 4 comments

"The Dart team recently overhauled the collection of features and APIs that allow developers access to JavaScript and browser bindings in their Dart code. This next generation of web interop not only improves user experience, but also enables Wasm support, aligning Dart with the future of the Web."

https://dart.dev/interop/js-interop

maxlapides avatar May 15 '24 01:05 maxlapides

Looks like there are only two files using dart:html:

https://github.com/segmentio/analytics_flutter/blob/91b2322d0d2ecc8078c0c3737ceae1e523dbe134/packages/core/lib/analytics_web.dart#L2

https://github.com/segmentio/analytics_flutter/blob/91b2322d0d2ecc8078c0c3737ceae1e523dbe134/packages/core/lib/utils/store/web.dart#L3

maxlapides avatar May 15 '24 01:05 maxlapides

Hi @maxlapides sorry to answer late, what version of flutter are you using?

When I try run flutter pub get on the project show me this message: image

I'm using Flutter 3.16.9

edsonjab avatar Jun 05 '24 03:06 edsonjab

boa tarde, remova esse importe e deve resolver o seu problema:

  • import 'package:segment_analytics/analytics_web.dart';

jardianoalmeida avatar Jun 12 '24 17:06 jardianoalmeida

@edsonjab So sorry, I just saw your note! I tested this on Flutter 3.22.

maxlapides avatar Jun 19 '24 22:06 maxlapides