1
1
---
2
2
title : Past JS interop
3
- description : Archive of past JS interop implementations .
3
+ description : Archive of Dart's previous JS interop support .
4
4
---
5
5
6
6
::: warning
7
7
None of these legacy interop libraries are supported when compiling to [ Wasm] [ ] .
8
8
:::
9
9
10
- This page addresses previous iterations of JS interop for Dart that are
11
- considered legacy. They are not deprecated yet, but will likely be in the
12
- future. Therefore, prefer using [ ` dart:js_interop ` ] going forwards and migrate
13
- usages of old interop libraries when possible. While [ ` dart:html ` ] and other web
14
- libraries are closely related, they're covered in the [ ` package:web ` ] page.
10
+ This page addresses previous iterations of JS interop for Dart that
11
+ have been considered legacy and are deprecated as of Dart 3.7.
12
+ Therefore, prefer using [ ` dart:js_interop ` ] [ ] going forwards and
13
+ migrate usages of old interop libraries when possible.
14
+ While [ ` dart:html ` ] [ ] and other web libraries are closely related,
15
+ they're covered in the [ ` package:web ` ] [ ] page.
16
+
17
+ [ `dart:js_interop` ] : {{site.dart-api}}/dart-js_interop/dart-js_interop-library.html
18
+ [ `dart:html` ] : {{site.dart-api}}/dart-html/dart-html-library.html
19
+ [ `package:web` ] : /interop/js-interop/package-web
15
20
16
21
## ` dart:js `
17
22
@@ -23,8 +28,8 @@ code-completion as you couldn't declare interop members and instead relied on
23
28
Strings. Many of the functionalities exposed in ` dart:js ` like [ ` allowInterop ` ]
24
29
were later re-exposed through other interop libraries.
25
30
26
- This library has been legacy ever since ` package:js ` and ` dart:js_util ` were
27
- released. It will likely be the first to be deprecated .
31
+ This library has been legacy since
32
+ ` package:js ` and ` dart:js_util ` were released .
28
33
29
34
## ` package:js `
30
35
@@ -50,7 +55,7 @@ There are significant differences, however:
50
55
` package:js ` type to ` dynamic ` and called an interop member on it, it would
51
56
forward to the right member. This is no longer possible with
52
57
` dart:js_interop ` .
53
- - ` package:js ` ' [ ` @JS ` ] has no soundness guarantees as return types of
58
+ - ` package:js ` ' ` @JS ` has no soundness guarantees as return types of
54
59
` external ` members were not checked. ` dart:js_interop ` is sound.
55
60
- ` package:js ` types could not rename instance members or have non-` external `
56
61
members.
@@ -101,20 +106,12 @@ and forth. This included members like:
101
106
` dart:js_interop ` and ` dart:js_interop_unsafe ` contain these helpers now with
102
107
possibly alternate syntax.
103
108
104
- {% comment %}
105
- TODO: add links (with stable) when ready:
106
- TODO: Link to ` package:web ` section
107
- {% endcomment %}
108
109
109
- [ `dart:js_interop` ] : {{site.dart-api}}/dart-js_interop/dart-js_interop-library.html
110
- [ `dart:html` ] : {{site.dart-api}}/dart-html/dart-html-library.html
111
- [ `package:web` ] : /interop/js-interop/package-web
112
110
[ `dart:js` ] : {{site.dart-api}}/dart-js/dart-js-library.html
113
111
[ `object wrapper` ] : {{site.dart-api}}/dart-js/JsObject-class.html
114
112
[ `allowInterop` ] : {{site.dart-api}}/dart-js_util/allowInterop.html
115
113
[ `package:js` ] : {{site.pub-pkg}}/js
116
114
[ `JSObject` ] : {{site.dart-api}}/dart-js_interop/JSObject-extension-type.html
117
- [ `@JS` ] : {{site.repo.dart.sdk}}/blob/main/sdk/lib/js/_js_annotations.dart#L11
118
115
[ tutorial on mocking ] : /interop/js-interop/mock
119
116
[ `@anonymous` ] : {{site.repo.dart.sdk}}/blob/main/sdk/lib/js/_js_annotations.dart#L40
120
117
[ `@staticInterop` ] : {{site.repo.dart.sdk}}/blob/main/sdk/lib/js/_js_annotations.dart#L48
0 commit comments