getObjects method

  1. @override
Future<List<ObjectResult>> getObjects(
  1. List<String> objectIds, {
  2. ObjectIncludeOptions? include,
})
override

Batched object reads: one entry per input id, in the same order.

Implementation

@override
Future<List<ObjectResult>> getObjects(
  List<String> objectIds, {
  ObjectIncludeOptions? include,
}) async {
  if (objectIds.isEmpty) return const [];
  final data = await _client.executeData(
    _multiGetObjectsOperation,
    generated.Variables$Query$MultiGetObjects(
      keys: objectIds
          .map((id) => schema.Input$ObjectKey(address: id))
          .toList(),
    ),
  );
  return data.multiGetObjects
      .map<ObjectResult>(
        (obj) => obj == null
            ? const ObjectError('Object not found')
            : ObjectSuccess(_mapObject(obj)),
      )
      .toList();
}