fetchStorageLocationsFromServer method

Future<List> fetchStorageLocationsFromServer(
  1. Multihash hash
)

Implementation

Future<List> fetchStorageLocationsFromServer(Multihash hash) async {
  final res = await httpClient.get(
    Uri.parse(
      '$readApiBaseUrl/s5/debug/storage_locations/${hash.toBase64Url()}',
    ),
  );

  final List uris = json.decode(res.body)['locations'];

  uris.sort((a, b) => -a['score'].compareTo(b['score']));
  return uris;
}