WheelGeometry.weighted constructor
Slices sized in proportion to weights. Falls back to equal sizes if
all weights are zero.
Implementation
factory WheelGeometry.weighted(List<double> weights) {
final double total = weights.fold(0.0, (a, b) => a + max(0.0, b));
if (total <= 0) return WheelGeometry.equal(weights.length);
return WheelGeometry._(
[for (final w in weights) max(0.0, w) / total * 2 * pi]);
}