followersIds method

Future<PaginatedIds> followersIds({
  1. String? userId,
  2. String? screenName,
  3. int? cursor,
  4. int? count,
  5. TransformResponse<PaginatedIds> transform = defaultPaginatedIdsTransform,
})

Returns a cursored collection of user IDs for every user following the specified user.

At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. Results are given in groups of 5,000 user IDs and multiple "pages" of results can be navigated through using the nextCursor value in subsequent requests. See https://developer.twitter.com/en/docs/basics/cursoring to navigate collections for more information.

This method is especially powerful when used in conjunction with usersLookup, a method that allows you to convert user IDs into full user objects in bulk.

userId: The ID of the user for whom to return results.

screenName: The screen name of the user for whom to return results.

cursor: Causes the results to be broken into pages. If no cursor is provided, a value of -1 will be assumed, which is the first "page."

The response from the API will include a previousCursor and nextCursor to allow paging back and forth. See Using cursors to navigate collections for more information.

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

See https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids.

Implementation

Future<PaginatedIds> followersIds({
  String? userId,
  String? screenName,
  int? cursor,
  int? count,
  TransformResponse<PaginatedIds> transform = defaultPaginatedIdsTransform,
}) async {
  final params = <String, String>{}
    ..addParameter('user_id', userId)
    ..addParameter('screen_name', screenName)
    ..addParameter('cursor', cursor)
    ..addParameter('count', count);

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