parseDoublesFromInlineList function

List<double>? parseDoublesFromInlineList(
  1. Object? s, [
  2. Pattern delimiter = ',',
  3. List<double>? def
])

Parses s to a List<double>.

delimiter pattern for delimiter if s is a String. def the default value if s is invalid.

Implementation

List<double>? parseDoublesFromInlineList(Object? s,
    [Pattern delimiter = ',', List<double>? def]) {
  if (s == null) return def;
  if (s is double) return [s];
  if (s is List) return s.map((e) => parseDouble(e)).toList() as List<double>?;
  return parseFromInlineList(
      s.toString(), delimiter, parseDouble as double Function(String)?, def);
}