parseStringFromInlineList function

List<String>? parseStringFromInlineList(
  1. Object? s, [
  2. Pattern? delimiter,
  3. List<String>? def
])

Parses s as inline List<String>.

delimiter The delimiter of elements.

def The default value if s is invalid.

Implementation

List<String>? parseStringFromInlineList(Object? s,
    [Pattern? delimiter, List<String>? def]) {
  if (s == null) return def;
  if (s is List) return s.map((e) => parseString(e, '')!).toList();
  delimiter ??= RegExp(r'\s*,\s*');
  return parseFromInlineList(
      s.toString(), delimiter, (e) => parseString(e, '')!, def);
}