parseNumsFromList function

List<num> parseNumsFromList(
  1. List list
)

Parses a generic list to a List<num>.

Implementation

List<num> parseNumsFromList(List list) {
  return list
      .map((e) {
        if (e is dart_math.Point) {
          return [e.x, e.y];
        } else if (e is String) {
          var parts = e.trim().split(_regexpSplitComma);
          var nums = parts.map((e) => parseNum(e)).toList();
          return nums.whereType<num>().toList();
        } else if (e is num) {
          return [e];
        } else {
          return <num>[];
        }
      })
      .expand((e) => e)
      .toList();
}