You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see ID is required so I have to pass in firebaseID but what this does is created a docId as the firebaseId but also creates a duplicate ID in the user object.
Can this library not be smart enough to know to use this ID as the docID only.
Also in other collections where I dont care about the docID I have to pass in an empty string in the ID as its required like this
Future<PlayerDb> insertOnePlayer(PlayerDbInsert player) async {
try {
final playerData =PlayerDb(
id:"",
name: player.name,
groupId: player.groupId,
createdDate:Timestamp.now().toDate(),
role: player.role,
userId: player.userId,
picture: player.picture,
status:"active");
final snapshot =await _playersRef.add(playerData);
final newPlayer =await snapshot.get();
final playerDoc = newPlayer.data;
if (playerDoc ==null) {
throwFirebaseException(
plugin:'cloud_firestore',
message:'Failed to retrieve the newly added player.',
);
}
return playerDoc;
} onFirebaseExceptioncatch (e) {
throwFirebaseException(
plugin:'cloud_firestore',
message:'Error adding player: ${e.message}',
);
}
}
Im not sure im not using the library correctly as I don't such much documentation around writing data.
Please can you help?
Thanks
Costa
The text was updated successfully, but these errors were encountered:
Hi
I am trying to create a user with a known firebaseId using the uid from firebase authentication.
Here is my model
As you can see in the model I have using the
@ID
annotation.This works ok when I allow firebase to create an ID for me.
This is my code that creates the user
As you can see ID is required so I have to pass in firebaseID but what this does is created a docId as the firebaseId but also creates a duplicate ID in the user object.
Can this library not be smart enough to know to use this ID as the docID only.
Also in other collections where I dont care about the docID I have to pass in an empty string in the ID as its required like this
Im not sure im not using the library correctly as I don't such much documentation around writing data.
Please can you help?
Thanks
Costa
The text was updated successfully, but these errors were encountered: