doubleOrZero static method

double doubleOrZero(
  1. DataSource source,
  2. List<Object> key
)

Returns a double from the specified double.

Returns 0.0 if it's not a double.

This is useful in situations where null is not acceptable, for example, when providing a decoder to list. Otherwise, prefer using DataSource.v directly.

Implementation

static double doubleOrZero(DataSource source, List<Object> key) {
  return source.v<double>(key) ?? 0.0;
}