Skip to content

How to retrieve the created_At property of a tweet? #195

Closed Answered by myConsciousness
JinZr asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @JinZr !

The Twitter API v2.0 is designed to add the necessary fields as needed.

https://developer.twitter.com/en/docs/twitter-api/fields

And this library supports this specification like below :)

import 'package:twitter_api_v2/twitter_api_v2.dart' as v2;

void main() async {
  final twitter = v2.TwitterApi(bearerToken: 'YOUR_TOKEN_HERE');

  try {
    final volumeStream = await twitter.tweetsService.connectVolumeStream(
      // Add this argument.
      tweetFields: [
        v2.TweetField.createdAt,
      ],
    );

    await for (final response in volumeStream.handleError(print)) {
      print(response.data.createdAt);
    }
  } on v2.TwitterException catch (e) {
    print(e);
  }
}

N…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by myConsciousness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants