parseBoolsFromInlineList function

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

Parses s to a List<bool>.

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

Implementation

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