friendshipsDestroy method

Future<User> friendshipsDestroy({
  1. String? userId,
  2. String? screenName,
  3. String tweetMode = 'extended',
  4. TransformResponse<User> transform = defaultUserTransform,
})

Allows the authenticating user to unfollow the user specified in the ID parameter.

Returns the unfollowed user when successful. Returns a string describing the failure condition when unsuccessful.

Actions taken in this method are asynchronous. Changes will be eventually consistent.

userId: The ID of the user to unfollow.

screenName: The screen name of the user to unfollow.

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/post-friendships-destroy.

Implementation

Future<User> friendshipsDestroy({
  String? userId,
  String? screenName,
  String tweetMode = 'extended',
  TransformResponse<User> transform = defaultUserTransform,
}) async {
  final body = <String, String>{}
    ..addParameter('user_id', userId)
    ..addParameter('screen_name', screenName)
    ..addParameter('tweet_mode', tweetMode);

  return client
      .post(
        Uri.https('api.twitter.com', '1.1/friendships/destroy.json'),
        body: body,
      )
      .then(transform);
}