Search code examples
flutter

I'm getting a lot of errors with the new web update to Flutter(3.22)


After upgrading to the new version 3.22 of Flutter, I can no longer output build on the web with chrome. Also there are errors that I never understand where they come from and what causes them

I first tried the basic “flutter clean” and “flutter pub get” commands but the problem was persistent.

Error Output :

class XRMediaBinding implements JSObject {
                                ^
../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/dom/xhr.dart:92:27: Error: The type 'JSObject' can't be used as supertype.
class FormData implements JSObject {
                          ^
../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/helpers/events/providers.dart:615:9: Error: The method 'typeofEquals' isn't defined for the class 'EventTarget'.
 - 'EventTarget' is from 'package:web/src/dom/dom.dart' ('../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/dom/dom.dart').
Try correcting the name to the name of an existing method, or defining a method named 'typeofEquals'.
  if (e.typeofEquals('undefined')) {
        ^^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/helpers/events/providers.dart:617:16: Error: The method 'hasProperty' isn't defined for the class 'EventTarget'.
 - 'EventTarget' is from 'package:web/src/dom/dom.dart' ('../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/dom/dom.dart').
Try correcting the name to the name of an existing method, or defining a method named 'hasProperty'.
  } else if (e.hasProperty('mozHidden'.toJS).toDart) {
               ^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/helpers/events/providers.dart:619:16: Error: The method 'hasProperty' isn't defined for the class 'EventTarget'.
 - 'EventTarget' is from 'package:web/src/dom/dom.dart' ('../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/dom/dom.dart').
Try correcting the name to the name of an existing method, or defining a method named 'hasProperty'.
  } else if (e.hasProperty('msHidden'.toJS).toDart) {
               ^^^^^^^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/helpers/events/providers.dart:621:16: Error: The method 'hasProperty' isn't defined for the class 'EventTarget'.
 - 'EventTarget' is from 'package:web/src/dom/dom.dart' ('../../AppData/Local/Pub/Cache/hosted/pub.dev/web-0.3.0/lib/src/dom/dom.dart').
Try correcting the name to the name of an existing method, or defining a method named 'hasProperty'.
  } else if (e.hasProperty('webkitHidden'.toJS).toDart) {
               ^^^^^^^^^^^
Failed to compile application.

Solution

  • I had the same issue and running Flutter pub upgrade solved the issue.

    flutter pub upgrade