findByName method

Future<HeliumResponse<List<HeliumHotspot>>> findByName(
  1. String query
)

Fetches the hotspots which mach a search term in the query parameter.

The query parameter needs to be at least one character, with 3 or more recommended.

Implementation

Future<HeliumResponse<List<HeliumHotspot>>> findByName(String query) async {
  if (query.isEmpty) {
    throw ArgumentError.value(query, 'query',
        'The `query` parameter must be at least one character in length.');
  }

  return _client._doRequest(HeliumRequest(
    path: '/v1/hotspots/name',
    parameters: {
      'search': query,
    },
    extractResponse: (json) =>
        HeliumRequest.mapDataList(json, (h) => HeliumHotspot.fromJson(h)),
  ));
}