id property

T get id

The unique identifier for this document.

This getter must be implemented by subclasses to provide the document's unique identifier of type T. The ID should be:

  • Unique within its collection
  • Consistent across app restarts for the same document
  • Valid as a Firestore document ID if using String type

Example:

@override
String get id => 'user-${DateTime.now().millisecondsSinceEpoch}';

Implementation

T get id;