letListOrNull<T> function

List<T>? letListOrNull<T>(
  1. dynamic input, {
  2. bool filterNulls = false,
  3. T? nullFallback,
})

Let's you convert input to a List type if possible, or returns null if the conversion cannot be performed.

If filterNulls is true, the returned list will not contain any null values. If nullFallback is provided, it will be used as a fallback value for null values.

Implementation

List<T>? letListOrNull<T>(
  dynamic input, {
  bool filterNulls = false,
  T? nullFallback,
}) {
  return letIterableOrNull<T>(
    input,
    filterNulls: filterNulls,
    nullFallback: nullFallback,
  )?.toList();
}