extractList<R> method

Future<List<R>> extractList<R>(
  1. String key,
  2. R fromJson(
    1. Map<String, dynamic> json
    )
)

等待响应完成后,自动提取列表 支持链式调用,适用于提取列表数据

示例:

final users = await http.send(...).extractList<User>('users', User.fromJson);

Implementation

Future<List<R>> extractList<R>(
  String key,
  R Function(Map<String, dynamic> json) fromJson,
) async {
  final response = await this;
  return response.extractList<R>(key, fromJson);
}