fastCalc method

FlutterMoney fastCalc({
  1. @required FastCalcType? type,
  2. @required double amount = 0,
})

returns FlutterMoneyFormatter after calculating amount.

Implementation

FlutterMoney fastCalc(
    {@required FastCalcType? type, @required double amount = 0}) {
  switch (type) {
    case FastCalcType.addition:
      this.amount += amount;
      break;

    case FastCalcType.substraction:
      this.amount -= amount;
      break;

    case FastCalcType.multiplication:
      this.amount *= amount;
      break;

    case FastCalcType.division:
      this.amount /= amount;
      break;

    case FastCalcType.percentageAddition:
      this.amount += (amount / 100) * this.amount;
      break;

    case FastCalcType.percentageSubstraction:
      this.amount -= (amount / 100) * this.amount;
      break;

    default:
      throw "Unknown calculation type.";
  }

  return this;
}