How do you access Twitter API Endpoints using flutter's built in Twitter API SDK?
I have an error in my program - It keeps showing XML-HTTP-REQUEST error when i try to show the data output from the twitter version 1.1 endpoint onto a flutter app using a Text widget that is a child of a container widget.
Could anybody give me some tips as to how I could access the Twitter dev. api in an easier way & or tell me how to resolve the aforementioned error?
The SDK I am using to access the Twitter Dev. Endpoint is the twitter_api listed on the developer website as one of the official SDKs for Flutter.
(P.S. Removed API and Token keys, they were there in my program earlier.)
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:twitter_api/twitter_api.dart';
final _twitterOauth = new twitterApi(
consumerKey: 'myconsumerkey was here',
consumerSecret: 'my consumer secret key was here',
token: 'my bearer token was here',
tokenSecret: 'my secret bearer token was here',
);
Future twitterRequest = _twitterOauth.getTwitterRequest(
"GET",
"statuses/user_timeline.json",
options: {
"user_id": "19025957",
"screen_name": "TTCnotices",
"count": "20",
"trim_user": "true",
"tweet_mode": "extended",
},
);
class Myapp extends StatelessWidget{
var res = await twitterRequest;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Text(res),
),
);
}
}
void main() {
runApp(Myapp());
}
}
from Recent Questions - Stack Overflow https://ift.tt/38jbrwh
https://ift.tt/eA8V8J
Comments
Post a Comment