calculationOnIntegerValue function

dynamic calculationOnIntegerValue(
  1. double lhs,
  2. double rhs, {
  3. bool add = false,
  4. bool subtract = false,
  5. bool multiply = false,
  6. bool divide = false,
})

Implementation

dynamic calculationOnIntegerValue(
  double lhs,
  double rhs, {
  bool add = false,
  bool subtract = false,
  bool multiply = false,
  bool divide = false,
}) {
  if (add == true &&
      subtract == false &&
      multiply == false &&
      divide == false) {
    return lhs + rhs;
  }

  if (subtract == true &&
      add == false &&
      multiply == false &&
      divide == false) {
    return lhs - rhs;
  }

  if (multiply == true &&
      add == false &&
      divide == false &&
      subtract == false) {
    return lhs * rhs;
  }

  if (divide == true &&
      add == false &&
      subtract == false &&
      multiply == false) {
    return lhs / rhs;
  } else {
    throw Exception(
        '"Select operation and Dont give two or more operation at the same time"');
  }
}