addPromotion method

Future<void> addPromotion (
  1. PromotionAdditionRequest req,
  2. {bool silent: false}
)

Implementation

Future<void> addPromotion(PromotionAdditionRequest req,
    {bool silent = false}) async {
  try {
    status = DataBackendStatus.LOADING;
    if (!silent) {
      notifyListeners();
    }
    await addPromitionToDatabase(req);
    creditCardsDirty = true;
    status = DataBackendStatus.OUTDATED;
    if (!silent) {
      notifyListeners();
    }
  } catch (err) {
    print(err.toString());
    status = DataBackendStatus.ERROR;
    if (!silent) {
      notifyListeners();
    } else {
      throw err;
    }
  }
}