makeChanges method

Future<FirestoreErrors?> makeChanges({
  1. String? newName,
})

Implementation

Future<FirestoreErrors?> makeChanges({
  String? newName,
}) async {
  final compneyID = B2bAuthUser.inUse?.compneyIdInUse;
  if (compneyID == null) return null;
  if (B2bAuthUser.inUse?.hasOwnerPermission != true) return null;
  final data = <String, Object?>{};
  if (_isNew) {
    data[fieldPath] = {"name": newName ?? name};
  } else {
    data["$fieldPath.name"] = newName ?? name;
  }
  return await firestore.updateDoc(
    docPath: "B2B/$compneyID",
    data: data,
  );
}