Package js has been discontinued in Flutter

Package js has been discontinued in Flutter
typescript
Ethan Jackson

I have upgraded flutter to latest version.

I have updated packages by flutter pub upgarde --major-versions

I did not use js directly in pubspec.yaml.

Still getting

js *0.6.7 *0.6.7 *0.6.7 0.7.2 (discontinued)

while debugging getting

JSArray<JSObject> transfer, ^^^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:34:37: Error: 'JSAny' isn't a type. extension type _CrossOriginLocation(JSAny? any) { ^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:51:23: Error: 'JSAny' isn't a type. CrossOriginWindow._(JSAny? o) : _window = _CrossOriginWindow(o); ^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:53:37: Error: 'JSAny' isn't a type. static CrossOriginWindow? _create(JSAny? o) { ^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:96:5: Error: 'JSAny' isn't a type. JSAny? message, [ ^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:97:5: Error: 'JSAny' isn't a type. JSAny? optionsOrTargetOrigin, ^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:98:13: Error: 'JSObject' isn't a type. JSArray<JSObject>? transfer, ^^^^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:98:5: Error: 'JSArray' isn't a type. JSArray<JSObject>? transfer, ^^^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:132:25: Error: 'JSAny' isn't a type. CrossOriginLocation._(JSAny? o) : _location = _CrossOriginLocation(o); ^^^^^ ../../../../.pub-cache/hosted/pub.dev/web-1.1.1/lib/src/helpers/cross_origin.dart:134:39: Error: 'JSAny' isn't a type. static CrossOriginLocation? _create(JSAny? o) {

how to fix it?

Answer

This Package is discontinued and not recommended to use further you can now use js_interop the pub.dev says

Caution

This package is discontinued. Prefer using dart:js_interop for JS interop. See the JS interop documentation for more details.

Related Articles