我在取消Firebase监听器时遇到异常
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following NoSuchMethodError was thrown while finalizing the widget tree:
Class 'DatabaseReference' has no instance method 'cancel'.
Receiver: Instance of 'DatabaseReference'
Tried calling: cancel()
这是我的代码
var databaseRef;
databaseRef = FirebaseDatabase.instance.reference().child("messages");
@override
void dispose() {
_sendMessageTextController.dispose();
databaseRef?.cancel();
super.dispose();
}
任何人都知道我为什么要超越execptioin
如果需要更多信息,请告诉我。提前致谢。您的努力将不胜感激。