TurboMapExtension extension
Extension on Map that provides utility methods for working with Firestore documents.
This extension adds functionality to handle common Firestore document operations such as:
- Managing document references
- Handling document IDs
- Managing timestamp fields (createdAt/updatedAt)
- on
Methods
-
tryAddLocalDocumentReference<
T, E> (DocumentReference< Object?> documentReference, {required String referenceFieldName, required bool tryAddLocalDocumentReference}) → Map<T, E> -
Available on Map, provided by the TurboMapExtension extension
Adds a local document reference field to the map if specified conditions are met. -
tryAddLocalId<
T, E> (String id, {required String idFieldName, required bool tryAddLocalId}) → Map< T, E> -
Available on Map, provided by the TurboMapExtension extension
This method is used to maintain a local ID field without storing it in the database. It's particularly useful for maintaining document IDs in DTOs and models. -
tryRemoveLocalDocumentReference<
T, E> ({required String referenceFieldName, required bool tryRemoveLocalDocumentReference}) → Map< T, E> -
Available on Map, provided by the TurboMapExtension extension
This method is used to clean up local document references that were added for internal use. -
tryRemoveLocalId<
T, E> ({required String idFieldName, required bool tryRemoveLocalId}) → Map< T, E> -
Available on Map, provided by the TurboMapExtension extension
This method is used to clean up local ID fields that were added for internal use. -
withCreatedAt<
T, E> ({required String createdAtFieldName}) → Map< T, E> -
Available on Map, provided by the TurboMapExtension extension
This method is used to automatically track when a document was created. The field name is configurable through the Firestore API setup. -
withCreatedAtAndUpdatedAt<
T, E> ({required String createdAtFieldName, required String updatedAtFieldName}) → Map< T, E> -
Available on Map, provided by the TurboMapExtension extension
This method is used to automatically track both creation and last update times. The field names are configurable through the Firestore API setup. -
withUpdatedAt<
T, E> ({required String updatedAtFieldName}) → Map< T, E> -
Available on Map, provided by the TurboMapExtension extension
This method is used to automatically track when a document was last updated. The field name is configurable through the Firestore API setup.