-2
I’m creating a bot that tweets on Dart. I’m having problems because I want to post with line break but I can’t, the following error appears when I try to convert a string into json through the twitter_api package:
When I assign the string to 'status' it gives this error
here is part of my code:
void tweetBuild(Map twitterKeys) async {
final String _tweetText = "In this part comes the tweet text, when I put \n, it doesn't works";
final _twitterOauth = new twitterApi(
consumerKey: twitterKeys['apiKey'],
consumerSecret: twitterKeys['apiKeySecret'],
token: twitterKeys['accessToken'],
tokenSecret: twitterKeys['acessTokenSecret']
);
Future tweetRequest = _twitterOauth.getTwitterRequest(
'POST',
'statuses/update.json',
options: {
'status' : _tweetText
}
);
var response = await tweetRequest;
print(response.statusCode);
print(response.body);
}
Tried to do the url-Match of your message with
Uri.encodeFull(_tweetText);
? Remember to import the respective library (Dart:core).– Naslausky
when it is posted, on twitter, it does not convert back, so it will all code
– Armando Neto