usersSearch method

Future<List<User>> usersSearch({
  1. required String q,
  2. int? page,
  3. int? count,
  4. bool? includeEntities,
  5. String tweetMode = 'extended',
  6. TransformResponse<List<User>> transform = defaultUserListTransform,
})

Provides a simple, relevance-based search interface to public user accounts on Twitter. Try querying by topical interest, full name, company name, location, or other criteria. Exact match searches are not supported.

Only the first 1,000 matching results are available.

q: The search query to run against people search.

page: Specifies the page of results to retrieve.

count: The number of potential user results to retrieve per page. This value has a maximum of 20.

includeEntities: The entities node will not be included in embedded Tweet objects 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.

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

Implementation

Future<List<User>> usersSearch({
  required String q,
  int? page,
  int? count,
  bool? includeEntities,
  String tweetMode = 'extended',
  TransformResponse<List<User>> transform = defaultUserListTransform,
}) async {
  final params = <String, String>{}
    ..addParameter('q', q)
    ..addParameter('page', page)
    ..addParameter('count', count)
    ..addParameter('include_entities', includeEntities)
    ..addParameter('tweet_mode', tweetMode);

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