parse method

Future<List<Point3D>> parse(
  1. String data
)

Parses a csv file with ',' as separator and x,y,z coordinates. Creates a List of Point3Ds.

Implementation

Future<List<Point3D>> parse(String data) async {
  return data
      .split('\n')
      .map((line) => line.split(','))
      .where((element) => element.length == 3)
      .map((e) =>
          Vector3(double.parse(e[0]), double.parse(e[2]), double.parse(e[1])))
      .map((e) => Point3D(e))
      .toList();
}