firebase - Flutter 应用程序因 dart.html 而停止工作

标签 firebase flutter dart

我正在开发 flutter 应用程序并向其添加 firebase 在我停止调试 session 并重新启动它后应用程序正常工作,错误开始出现.. flutter doctor 不返回任何错误。我试图 flutter 干净,但这是徒劳的 所有与firebase相关的代码

import 'dart:io';
import 'package:circles/Services/storage.dart';
import 'package:circles/models/user-model.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';

class AuthService {
  /// This Class will handle all the process related to the auth and account including:
  /// - the process of saving the user data to the cloud
  /// - Uploading the User Images will start from this class
  /// - Starting the app will run currentUser() to check if there is a user recorded locally in the device
  static FirebaseAuth _auth = FirebaseAuth.instance;
  static Firestore _firestore = Firestore.instance;

  static Future<FirebaseUser> currentUser() async {
    assert(_auth != null);
    FirebaseUser currentUser = await _auth.currentUser();
    return currentUser;
  }

  static Future<FirebaseUser> signIn(String email, String password) async {
    assert(_auth != null);
    AuthResult result = await _auth.signInWithEmailAndPassword(
        email: email.trim(), password: password.trim());

    assert(result != null);
    FirebaseUser currentUser = result.user;
    return currentUser;
  }

  static Future<FirebaseUser> signUp(String email, String password) async {
    // Create a new User with Email/Password
    assert(_auth != null);
    AuthResult result = await _auth.createUserWithEmailAndPassword(
        email: email, password: password);

    assert(result != null);
    FirebaseUser currentUser = result.user;
    return currentUser;
  }

  static bool sendUserForgetPasswordEmail(String email) {
    // Return a bool to return the user email request is completed or not
    bool isCompleted = false;
    _auth.sendPasswordResetEmail(email: email.trim()).whenComplete(() {
      isCompleted = true;
    });

    return isCompleted;
  }

// Save and Retrive the User data funcs will be defined here is it related to the user
// Two Main Funcs: save/fetch

// Updating data func will be defined here also and updating data that related
//to circles as it will be connected to the user himself

  static Future<void> saveUserProfileData(User user, File imageFile) async {
    user.imageUrl = Storage.uploadUserImage(imageFile) as String;
    // Create a new doc with id :(_auth.currentUser().then((user) => user.uid));
    // Save the User data in Map format in the doc and The Personal Image will be stored in the storage
    _firestore
        .collection("USERS")
        .document(await _auth.currentUser().then((user) => user.uid))
        .setData(user.toMap());
  }

  static Future<User> fetchUserProfileData() async {
    // Get the currentUser Data by its uid and return User() with all the data
    return _firestore
        .collection("USERS")
        .document(await _auth.currentUser().then((value) => value.uid))
        .get()
        .then<dynamic>((DocumentSnapshot snapshot) {
      if (snapshot.data.isNotEmpty)
        return User.mapToUser(snapshot.data);
      else
        return null;
    });
  }
}

Pubspec.yaml 依赖项

  cupertino_icons: ^0.1.3
  firebase_auth: ^0.14.0+5
  cloud_firestore: ^0.12.9+4
  firebase_storage: ^3.0.4
  location: ^3.0.2

minSdkVersion 23

错误

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
       ^
/C:/src/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:5:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
       ^
/C:/src/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;
^
/C:/src/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';
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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) {
                        ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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));
                         ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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) {
                        ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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));
          ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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))));
        ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var onCompleteWrap = allowInterop(
                         ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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,
                       ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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(
                             ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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)));
                     ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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) {
                          ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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) {
                           ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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) {
                          ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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);
                          ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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) {
                           ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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) {
          ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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));
                         ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/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' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var onCompletion = allowInterop(() => _changeController.close());
                         ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:194:7: Error: Method not found: 'hasProperty'.    
  if (js.hasProperty(error, 'message')) {
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:195:19: Error: Method not found: 'getProperty'.   
    var message = js.getProperty(error, 'message');
                  ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:29:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(jsObject, 'firestore') &&
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:30:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(jsObject, 'id') &&
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:31:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(jsObject, 'parent')) {
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:37:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(jsObject, 'latitude') &&
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:38:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(jsObject, 'longitude') &&
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:44:15: Error: Method not found: 'getProperty'.
  var proto = util.getProperty(jsObject, '__proto__');
              ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:46:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(proto, 'toDate') &&
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:47:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(proto, 'toMillis')) {
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:52:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(proto, 'isEqual') &&
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:53:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(proto, 'toBase64')) {
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:67:24: Error: Method not found: 'getProperty'.
    map[key] = dartify(util.getProperty(jsObject, key));
                       ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:91:17: Error: Method not found: 'newObject'.
    var jsMap = util.newObject();
                ^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:93:7: Error: Method not found: 'setProperty'.
      util.setProperty(jsMap, key, jsify(value));
      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:116:12: Error: Method not found: 'allowInterop'.      
    return allowInterop(dartObject);
           ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:124:5: Error: Method not found: 'callMethod'.
    util.callMethod(jsObject, method, args);
    ^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:139:19: Error: Method not found: 'promiseToFuture'.   
    value = await util.promiseToFuture(thenable);
                  ^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:141:9: Error: Method not found: 'hasProperty'.
    if (util.hasProperty(e, 'code')) {
        ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:152:27: Error: Method not found: 'allowInterop'.      
  return PromiseJsImpl<S>(allowInterop((
                          ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:165:5: Error: Method not found: 'allowInterop'.
    allowInterop(c.completeError);
    ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:173:22: Error: Method not found: 'getProperty'.       
  String get code => util.getProperty(_source, 'code');
                     ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:176:25: Error: Method not found: 'getProperty'.
  String get message => util.getProperty(_source, 'message');
                        ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:179:22: Error: Method not found: 'getProperty'.       
  String get name => util.getProperty(_source, 'name');
                     ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:182:32: Error: Method not found: 'getProperty'.
  Object get serverResponse => util.getProperty(_source, 'serverResponse');
                               ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:185:23: Error: Method not found: 'getProperty'.       
  String get stack => util.getProperty(_source, 'stack');
                      ^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:105:30: Error: The method 'allowInterop' isn't defined for the class 'Firestore'.
 - 'Firestore' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var updateFunctionWrap = allowInterop((transaction) =>
                             ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:306:11: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
 - 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((firestore_interop.DocumentSnapshotJsImpl snapshot) {
          ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:310:26: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
 - 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => controller.addError(e));
                         ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:445:9: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((firestore_interop.QuerySnapshotJsImpl snapshot) {
        ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:449:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var errorWrapper = allowInterop((e) => controller.addError(e));
                       ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:775:9: Error: The method 'allowInterop' isn't defined for the class 'QuerySnapshot'.
 - 'QuerySnapshot' is from 'package:firebase/src/firestore.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((s) => callback(DocumentSnapshot.getInstance(s)));
        ^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/interop/js_interop.dart:17:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(jsObject, 'toDateString')) {
      ^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:20:41: Error: Getter not found: 'window'.
  final String navigatorPlatform = html.window.navigator.platform?.toLowerCase() ?? '';
                                        ^^^^^^
/C:/src/flutter/packages/flutter/lib/src/foundation/_platform_web.dart:40:12: Error: Getter not found: 'window'.
  if (html.window.matchMedia('only screen and (pointer: fine)').matches) {
           ^^^^^^
/C:/src/flutter/packages/flutter/lib/src/painting/_network_image_web.dart:91:12: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
    return ui.webOnlyInstantiateImageCodecFromUrl(resolved, // ignore: undefined_function
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unhandled exception:                                                    
FileSystemException(uri=org-dartlang-untranslatable-uri:dar
t%3Ahtm
l; message=StandardFileSystem only supports file:* and data:* URIs)     
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1      asFileUri (package:vm/kernel_front_end.dart:657:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:825:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:572:15)
<asynchronous suspension>
#4      _FlutterFrontendCompiler.compile (package:flutter_frontend_server/server.dart:43:22)
#5      starter (package:flutter_frontend_server/server.dart:182:27)    
#6      main (file:///C:/b/s/w/i
r/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:9:30)
#7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#8      _RawRece
ivePortImpl._
handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

                                                                        
                                                                        
FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 897
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full 
insights.

* Get more help at https://help.gradle.org

我找到了一个解决方案,上面写着删除 package:firebase/firestore.dart 但我没有使用它

最佳答案

在我的例子中,我不小心导入了:'package:firebase/firestore.dart'; 而不是“package:cloud_firestore/cloud_firestore.dart”;

关于firebase - Flutter 应用程序因 dart.html 而停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63717983/

相关文章:

android - 在 Google Play 服务 9.6.1 中使用最新的 Smooch 版本 (4.0.5) 时,应用程序崩溃

flutter - 如何强制 Flutter/Dart 要求类型?

flutter - 多个按钮/文本在一个圆圈中 flutter

android - 更改包名称后 Flutter App 无法正常工作

firebase - 如何在 Unity 上的 Firebase 身份验证中获取 googleTokenID 和 googleAccessToken

ios - 将时间戳从 Firebase 转换为 Time Ago

java - 如何在 Cloud Firestore 中使用 startAt() 和 endAt()?

flutter - 如何关闭抽屉返回首页?

android - MaterialApp窗口小部件的标题属性不起作用

flutter - PS256 在 Flutter/Dart 中签名