DataSourceFirebaseSource<T extends BaseEntityDataModel>.edit constructor

DataSourceFirebaseSource<T extends BaseEntityDataModel>.edit({
  1. required BaseEntityDataModel dataModel,
  2. required String path,
  3. Object? file,
  4. String? oldImg = "",
  5. String? imageField = "image",
})

Factory constructor for editing data in Firebase.

The dataModel parameter specifies the data model to edit. The path parameter specifies the Firestore collection path. The file parameter is an optional file to upload. The oldImg parameter specifies the old image URL to delete. The imageField parameter specifies the field name for the image.

Implementation

factory DataSourceFirebaseSource.edit({
  required BaseEntityDataModel dataModel,
  required String path,
  Object? file,
  String? oldImg = "",
  String? imageField = "image",
}) {
  return DataSourceFirebaseSource(path)
    .._data = dataModel
    .._file = file
    ..imageField = imageField!
    ..deleteUrl = oldImg!;
}