friendsList method
- String? userId,
- String? screenName,
- int? cursor,
- int? count,
- bool? skipStatus,
- bool? includeUserEntities,
- String tweetMode = 'extended',
- TransformResponse<
PaginatedUsers> transform = defaultPaginatedUsersTransform,
Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends").
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 20 users 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.
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.
count
: The number of users to return per page, up to a maximum of 200.
Defaults to 20.
skipStatus
: When set to true
, statuses will not be included in the
returned user objects. If set to any other value, statuses will be
included.
includeUserEntities
: The user object entities node will not be included
when set to false
.
tweetMode
: When set to extended
, uses the extended Tweets.
See https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/intro-to-tweet-json#extendedtweet.
transform
: Can be used to parse the request. By default, the response is
parsed in an isolate.
Implementation
Future<PaginatedUsers> friendsList({
String? userId,
String? screenName,
int? cursor,
int? count,
bool? skipStatus,
bool? includeUserEntities,
String tweetMode = 'extended',
TransformResponse<PaginatedUsers> transform =
defaultPaginatedUsersTransform,
}) async {
final params = <String, String>{}
..addParameter('user_id', userId)
..addParameter('screen_name', screenName)
..addParameter('cursor', cursor)
..addParameter('count', count)
..addParameter('skip_status', skipStatus)
..addParameter('include_user_entities', includeUserEntities)
..addParameter('tweet_mode', tweetMode);
return client
.get(Uri.https('api.twitter.com', '1.1/friends/list.json', params))
.then(transform);
}