【发布时间】:2020-11-27 23:38:41
【问题描述】:
我试图在听文档快照时捕获 firstore 插件在颤振中抛出的错误。该错误在调试日志中引发,但我无法在捕获错误或处理错误时访问它。这是插件需要的增强功能还是有办法?
调试出错
I/System.out(16041): com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: 权限缺失或不足。
这是我的代码,我尝试了很多方法,但都没有成功
_getUserCollection.document(uid).snapshots();
_getUserCollection.document(uid).snapshots().handleError((onError) {
print(onError.toString());
});
try {
_getUserCollection.document(uid).snapshots();
} catch (e) {
print(e);
}
try {
_getUserCollection.document(uid).snapshots();
} on PlatformException catch (e) {
print(e.toString());
}
_getUserCollection.document(uid).snapshots().listen((event) {
print('here on listen');
}, onError: (e) {
print('on error $e');
});
【问题讨论】:
标签: firebase flutter error-handling google-cloud-firestore firebase-security