addByUid method

Future addByUid({
  1. required InterfacePlus object,
})

Adds a document with a specific UID.

Creates a new document in Firestore with the specified UID. If a document with that UID already exists, it will be overwritten.

Usage

final user = User(uid: 'custom123', name: 'John Doe', email: 'john@example.com');
await userCollection.addByUid(object: user);

Parameters

  • object: The object to add (must implement InterfacePlus)

Behavior

  • If the document doesn't exist, it will be created
  • If the document already exists, it will be overwritten
  • The UID from the object is used as the document ID

Implementation

Future addByUid({required InterfacePlus object}) async {
  return await _getCollection.doc(uid).set(object.json);
}