applyPercent method

double applyPercent(
  1. double percent
)

Applies a percentage to this number (adds percentage).

Example:

int price = 100;
double result = price.applyPercent(20); // 120.0 (100 + 20%)

Implementation

double applyPercent(double percent) => this * (1 + percent / 100);