applyRatio method

double? applyRatio(
  1. double ratio
)

Applies a ratio multiplier to the value.

Returns null if the value is null.

Example:

100.0.applyRatio(0.5);  // 50.0
(null).applyRatio(2.0); // null

Implementation

double? applyRatio(double ratio) {
  final value = this;
  if (value == null) {
    return null;
  }
  return value * ratio;
}