![](/img/trans.png)
[英]Firebase Firestore custom sync rules | Flutter - Dart
[英]iam using firebase firestore (flutter) dart
您正在嘗試直接從DocumentSnapshot
獲取userType
字段,這將返回null
,您需要從Map<String, dynamic>
獲取字段數據,這是從data()
返回的,因此您需要更改:
userType = documentSnapshot['userType'];
有了這個:
userType = (documentSnapshot.data() as Map<String, dynamic>)['userType'];
這會將userType字段的值保存在userType
變量中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.