parseIntsFromInlineList function
Parses s to a List<int>.
delimiter pattern for delimiter if s is a String.
def the default value if s is invalid.
Implementation
List<int>? parseIntsFromInlineList(
Object? s, [
Pattern delimiter = ',',
List<int>? def,
]) {
if (s == null) return def;
if (s is int) return [s];
if (s is List) {
return s
.map((e) => parseInt(e))
.where((e) => e != null)
.cast<int>()
.toList();
}
return parseFromInlineList(s.toString(), delimiter, (v) => parseInt(v)!, def);
}