Home > Blockchain >  The method 'delete' isn't defined for the class 'AppJsImpl'
The method 'delete' isn't defined for the class 'AppJsImpl'

Time:07-23

I develop the flutter app connected with Firebase. The app work well on mobile devices, but when i try to build web i get this error:

/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());

I tried to put firebase_database_web: ^0.1.2 1 in pubspec.yaml, but error is still here. Did someone have the same problem, and how are you fixed?

Thanks

CodePudding user response:

I have tackled the issue by adding a row in the "app_interop.dart" file.

Before:

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

After:

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