parseNumsFromInlineList function

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

Parses s to a List<num>.

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

Implementation

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