discount method

void discount(
  1. double percent
)

Applies a discount percentage to the reactive double (subtracts percentage).

Example:

final price = swift(100.0);
price.discount(20); // price.value is now 80.0

Implementation

void discount(double percent) {
  value = value * (1 - percent / 100);
}