updateMany method

  1. @override
Future<List<Map<String, Object?>>> updateMany({
  1. required UpdateBody body,
  2. String? authorization,
})
override

Implementation

@override
Future<List<Map<String, Object?>>> updateMany({
  required UpdateBody body,
  String? authorization,
}) async {
  final response = await _client.request(
    method: 'PATCH',
    path: '/db/many',
    headers: {'authorization': authorization},
    body: body,
  );

  final _body = await response.transform(utf8.decoder).join();

  if (jsonDecode(_body) case {'data': final List data}) {
    return data
        .map(
          (e) => (e as Map).map(
            (key, value) => MapEntry((key as String), value),
          ),
        )
        .toList();
  }

  throw Exception('Invalid response');
}