makeChanges method

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

Implementation

Future<FirestoreErrors?> makeChanges({
  String? newName,
}) async {
  if (id == -1) return null;
  final compneyID = B2bAuthUser.inUse?.compneyIdInUse;
  if (compneyID == null) return null;

  if (B2bAuthUser.inUse?.hasOwnerPermission != true) return null;
  return await firestore.updateDoc(
    docPath: "B2B/$compneyID",
    data: {
      if (isNew) "nextUsableSellerID": FieldValue.increment(1),
      fieldPath: {"name": newName ?? name}
    },
  );
}