letIterableOrNull<T> function
Converts input
to Iterable<Option<T>>
, returning Null on failure.
Supported types:
Implementation
Iterable<T?>? letIterableOrNull<T>(dynamic input) {
final nullable = isNullable<T>();
if (!nullable && input == null) return null;
dynamic decoded;
if (input is String) {
decoded = jsonDecodeOrNull<Iterable<dynamic>>(input.trim());
} else {
decoded = input;
}
if (decoded is Iterable) {
return decoded.map(letOrNull<T>);
}
return null;
}