jsonDecodeListAs<T> function

List<T> jsonDecodeListAs<T>(
  1. dynamic json
)

Decodes and casts a JSON string into a List<T>.

Returns an empty list for invalid or empty input.

final result = jsonDecodeListAs<int>('[1, 2, 3]');
print(result); // [1, 2, 3]

May throw errors for invalid types.

@ai Use when you need a list result regardless of input validity.

Implementation

List<T> jsonDecodeListAs<T>(final dynamic json) =>
    jsonDecodeList(json).cast<T>();