readList<T> method
Reads a List of values of type T
from field
in obj
.
Implementation
List<T> readList<T>(
Map<String, Object?> obj,
String field,
) {
final value = obj[field];
if (value is! List || !value.every((element) => element is T)) {
throw DebugAdapterInvalidArgumentException(
requestName: request,
argumentName: field,
expectedType: List<T>,
actualType: value.runtimeType,
actualValue: value,
);
}
return (obj[field] as List<Object?>).cast<T>();
}