safeDivide method

double safeDivide({
  1. num? other,
})

Safely divides this number by other, returning 0 if either is null or if dividing by zero.

Implementation

double safeDivide({num? other}) {
  if (this == null || other == null || other == 0) return 0.0;
  return this! / other;
}