closest method

Future<List<TrendLocation>> closest({
  1. required String lat,
  2. required String long,
  3. TransformResponse<List<TrendLocation>> transform = defaultTrendLocationsTransform,
})

Returns the locations that Twitter has trending topic information for, closest to a specified location.

lat: If provided with a long parameter the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude is -180.0 to +180.0 (West is negative, East is positive) inclusive.

long: If provided with a lat parameter the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude is -180.0 to +180.0 (West is negative, East is positive) inclusive.

transform: Can be used to parse the request. By default, the response is parsed in an isolate.

See https://developer.twitter.com/en/docs/twitter-api/v1/trends/locations-with-trending-topics/api-reference/get-trends-closest.

Implementation

Future<List<TrendLocation>> closest({
  required String lat,
  required String long,
  TransformResponse<List<TrendLocation>> transform =
      defaultTrendLocationsTransform,
}) {
  final params = <String, String>{}
    ..addParameter('lat', lat)
    ..addParameter('long', long);

  return client
      .get(
        Uri.https('api.twitter.com', '/1.1/trends/closest.json', params),
      )
      .then(transform);
}