Advertisement
Sajid576

firestore write using ArrayUnion

Jan 26th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. Future<void> updateUserData(String bus_id, String speed, GeoPoint geoPoint) async {
  2. Map<String, dynamic>data=new Map();
  3. data['coordinate']=geoPoint;
  4. data['velocity']=speed;
  5. var list=new List<Map<String, dynamic>>();
  6. list.add(data);
  7. print("write func invoked");
  8.  
  9. firestoreref.document(bus_id).setData({
  10. 'locations': FieldValue.arrayUnion(list)
  11. });
  12.  
  13.  
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement