drafterFinite function

double drafterFinite(
  1. double value, [
  2. double fallback = 0
])

Returns value when it is finite, otherwise fallback (0 by default).

Renderers funnel raw input values through this at ingestion so an upstream NaN/Infinity (e.g. from a 0 / 0) can never reach a Canvas primitive or toInt() — a non-finite coordinate trips a debug assert, and a non-finite toInt() throws UnsupportedError even in release builds.

Implementation

double drafterFinite(double value, [double fallback = 0]) =>
    value.isFinite ? value : fallback;