id property

String get id

The unique string identifier for this object.

This getter must be implemented by subclasses to provide the object's unique identifier. The ID should be:

  • Unique within its collection
  • Consistent across app restarts for the same object
  • Valid as a Firestore document ID

Example:

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

Implementation

String get id;