safeDivide method
Safely divides two numbers with custom handling for division by zero and zero values.
- Returns
whenBothZeroif boththisandbare zero. - Returns
whenDivByZeroif dividing by zero unlessreturnNaNOnDivByZeroistrue. - Otherwise, returns
this / b.
Implementation
double safeDivide(
num b, {
num whenBothZero = 0,
num whenDivByZero = double.infinity,
bool returnNaNOnDivByZero = false,
}) =>
NumbersHelper.safeDivide(
this,
b,
whenDivByZero: whenDivByZero,
whenBothZero: whenBothZero,
returnNaNOnDivByZero: returnNaNOnDivByZero,
);