makeDataPoints function

List<DragDataPoint> makeDataPoints(
  1. List table
)

Implementation

List<DragDataPoint> makeDataPoints(List<dynamic> table) {
  return table.map((point) {
    return switch (point) {
      DragDataPoint p => p,
      Map m
          when (m['mach'] ?? m['Mach']) != null &&
              (m['cd'] ?? m['CD']) != null =>
        (
          mach: ((m['mach'] ?? m['Mach']) as num).toDouble(),
          cd: ((m['cd'] ?? m['CD']) as num).toDouble(),
        ),
      _ => throw TypeError(),
    };
  }).toList();
}