optPositiveDouble method

double? optPositiveDouble(
  1. String name, {
  2. double fallback = -1.0,
  3. bool remove = false,
})

Returns the value mapped by name if it exists and is a positive double or can be coerced to a positive double, or fallback otherwise. If remove is true, then the mapping will be removed from the Map.

Implementation

double? optPositiveDouble(String name,
    {double fallback = -1.0, bool remove = false}) {
  double d = optDouble(name, fallback: fallback);
  double? value = (d >= 0) ? d : null;
  if (remove) {
    this?.remove(name);
  }
  return value;
}