IB MR
IB MR

Reputation: 385

Flutter "Error: Not found: 'dart:html' import 'dart:html';"

I'm trying to integrate firebase into my flutter code and I installed the firebase_core: ^0.4.0+9. However, when I try to run the app, I get following errors

import 'dart:html';
       ^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js.dart:8:1: Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util'
export 'dart:js_util';
^
lib/main.dart:19:47: Error: Getter not found: 'Firebase'.
  final Future<FirebaseApp> _initialization = Firebase.initializeApp();
                                              ^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/auth.dart:306:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) {
                        ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/auth.dart:310:26: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => _changeController.addError(e));
                         ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/auth.dart:340:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) {
                        ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/auth.dart:345:11: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((e) => _idTokenChangedController.addError(e));
          ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart:164:9: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
 - 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((update) => jsify(transactionUpdate(dartify(update))));
        ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart:166:26: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
 - 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var onCompleteWrap = allowInterop(
                         ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart:301:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/database.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var callbackWrap = allowInterop((database_interop.DataSnapshotJsImpl data,
                       ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart:325:30: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/database.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    jsObject.once(eventType, allowInterop(
                             ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart:402:22: Error: The method 'allowInterop' isn't defined for the class 'DataSnapshot'.
 - 'DataSnapshot' is from 'package:firebase/src/database.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var actionWrap = allowInterop((d) => action(DataSnapshot.getInstance(d)));
                     ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart:72:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((payload) {
                          ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart:75:28: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final errorWrapper = allowInterop((e) {
                           ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart:87:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((payload) {
                          ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart:97:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((_) => null);
                          ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart:98:28: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final errorWrapper = allowInterop((e) {
                           ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/storage.dart:317:11: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((storage_interop.UploadTaskSnapshotJsImpl data) {
          ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/storage.dart:321:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => _changeController.addError(e));
                         ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/storage.dart:322:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var onCompletion = allowInterop(() {
                         ^^^^^^^^^^^^
../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.2/lib/src/top_level.dart:196:7: Error: Method not found: 'hasProperty'.
  if (js.hasProperty(error, 'message')) {
      ^^^^^^^^^^^```

I don't know what to do, because the errors are regarding HTML and js files, while I'm only using dart for mobile development. I have also deleted my tests widget and folder, can that be the issue?

Upvotes: 1

Views: 3140

Answers (4)

Ossama Iradukunda
Ossama Iradukunda

Reputation: 11

You can solve it by removing import 'package:firebase/firebase.dart'; where it's not being used.

Upvotes: 1

Visakh Vijayakumar
Visakh Vijayakumar

Reputation: 21

Can you check your import section includes 'dart.html'? If yes please remove it and rebuild.

Upvotes: 0

Rajitha Udayanga
Rajitha Udayanga

Reputation: 1732

Find import statement import 'dart:html'; and remove it.

Upvotes: 0

LucasACH
LucasACH

Reputation: 169

Just try removing "import 'dart:html';" from your imports.

Upvotes: 0

Related Questions