TurboFirestoreCreateApi<T> extension

Extension that adds create operations to TurboFirestoreApi

Provides methods for creating and writing documents to Firestore

Features:

  • Single document creation
  • Batch operations
  • Transaction support
  • Automatic timestamp management
  • Document merging
  • Field-level merging
  • Validation through TurboWriteable

Example:

final api = TurboFirestoreApi<User>();
final user = User(name: 'John');
final response = await api.createDoc(writeable: user);

See also: TurboFirestoreUpdateApi document updates TurboFirestoreDeleteApi document deletion

on

Methods

createDoc({required TurboWriteable writeable, String? id, WriteBatch? writeBatch, TurboTimestampType createTimeStampType = TurboTimestampType.createdAtAndUpdatedAt, TurboTimestampType updateTimeStampType = TurboTimestampType.updatedAt, bool merge = false, List<FieldPath>? mergeFields, String? collectionPathOverride, Transaction? transaction}) Future<TurboResponse<DocumentReference<Object?>>>

Available on TurboFirestoreApi, provided by the TurboFirestoreCreateApi extension

Creates or writes a document to Firestore.
createDocInBatch({required TurboWriteable writeable, String? id, WriteBatch? writeBatch, TurboTimestampType createTimeStampType = TurboTimestampType.createdAtAndUpdatedAt, TurboTimestampType updateTimeStampType = TurboTimestampType.updatedAt, bool merge = false, List<FieldPath>? mergeFields, String? collectionPathOverride}) Future<TurboResponse<WriteBatchWithReference<Map<String, dynamic>>>>

Available on TurboFirestoreApi, provided by the TurboFirestoreCreateApi extension

Creates or writes documents using a batch operation.