optStringsFromArrayOrSingle method
Returns the value mapped by name
if it exists and is either a List of String or a
single String value, or an empty list otherwise.
If remove
is true, then the mapping will be removed from the Map.
E.g. "a", "b"
or "a"
Implementation
List<String> optStringsFromArrayOrSingle(String name, {bool remove = false}) {
dynamic value = (remove) ? this?.remove(name) : opt(name);
if (value is Map) {
return (value).values.whereType<String>().toList();
} else if (value is List) {
return value.whereType<String>().toList();
} else if (value is String) {
return [value];
} else {
return [];
}
}