toFlatListOfStrings function

List<String> toFlatListOfStrings(
  1. Object? s, {
  2. Pattern? delimiter,
  3. bool trim = true,
  4. bool ignoreEmpty = true,
})

Converts s to a List<String>. Converts any collection to a flat list of strings.

Implementation

List<String> toFlatListOfStrings(Object? s,
    {Pattern? delimiter, bool trim = true, bool ignoreEmpty = true}) {
  if (s == null) {
    return <String>[];
  } else if (s is String) {
    return _toFlatListOfStringsFromString(
        s, delimiter ?? _toListOfStringsDelimiter, trim, ignoreEmpty);
  } else if (s is Iterable) {
    return _toFlatListOfStringsFromIterable(
        s, delimiter ?? _toListOfStringsDelimiter, trim, ignoreEmpty);
  } else {
    return _toFlatListOfStringsFromString(
        '$s', delimiter ?? _toListOfStringsDelimiter, trim, ignoreEmpty);
  }
}