toList<T> function

List<T> toList<T>(
  1. dynamic value, {
  2. T fromJson(
    1. dynamic json
    )?,
})

Converts value to List or throws FormatException if conversion fails.

Implementation

List<T> toList<T>(dynamic value, {T Function(dynamic json)? fromJson}) =>
    toListOrNull<T>(value, fromJson: fromJson) ??
    (throw FormatException('Invalid List<$T> value: $value'));