【问题标题】:The method 'delete' isn't defined for the class 'AppJsImpl'没有为“AppJsImpl”类定义“删除”方法
【发布时间】:2022-07-23 01:18:08
【问题描述】:

我开发了与 Firebase 连接的颤振应用。 该应用程序在移动设备上运行良好,但是当我尝试构建网络时出现此错误:

/D:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database_web-0.1.2/lib/src/interop/app.dart:35:59: Error: The method 'delete' isn't defined for the class 'AppJsImpl'.
- 'AppJsImpl' is from 'package:firebase_database_web/src/interop/app_interop.dart' ('/D:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database_web-0.1.2/lib/src/interop/app_interop.dart').
package:firebase_database_web/…/interop/app_interop.dart:1
Try correcting the name to the name of an existing method, or defining a method named 'delete'.
 Future delete() => core_interop.handleThenable(jsObject.delete());

我尝试将 firebase_database_web: ^0.1.2+1 放入 pubspec.yaml,但错误仍然存​​在。 有人有同样的问题吗,你是怎么解决的?

谢谢

【问题讨论】:

    标签: flutter firebase visual-studio-code


    【解决方案1】:

    我已经通过在“app_interop.dart”文件中添加一行来解决这个问题。

    之前:

    @JS('App')
    abstract class AppJsImpl extends core_interop.AppJsImpl {
      external DatabaseJsImpl database(String? databaseURL);
    }
    

    之后:

    @JS('App')
    abstract class AppJsImpl extends core_interop.AppJsImpl {
      external DatabaseJsImpl database(String? databaseURL);
      external dynamic delete();
    }
    

    【讨论】:

      猜你喜欢
      • 2011-01-05
      • 2021-09-02
      • 2019-06-24
      • 2021-01-30
      • 2020-09-10
      • 2019-05-23
      • 1970-01-01
      • 2022-11-21
      • 2021-08-02
      相关资源
      最近更新 更多