forceListOf<T> function

List<T> forceListOf<T>(
  1. dynamic item
)

Ensure the given item is a List of type T.

If item is null, an empty list is returned. If item is already a List, a copy of items converted into T is returned. Otherwise, return item converted into T and wrapped in a list.

Implementation

List<T> forceListOf<T>(dynamic item) => forceList(item).map((e) => changeTo<T>(e)).toList();