tryList<T> method

List<T>? tryList<T>(
  1. K key
)

Returns the List<T> value for key, or null if absent or not a List<T>.

Implementation

List<T>? tryList<T>(K key) {
  final value = this[key];
  if (value is! List) return null;
  try {
    return value.cast<T>();
  } catch (_) {
    return null;
  }
}