shareTwitter static method
Implementation
static Future<String?> shareTwitter(String captionText,
{List<String>? hashtags, String? url, String? trailingText}) async {
Map<String, dynamic> args;
String modifiedUrl;
if (Platform.isAndroid) {
modifiedUrl = Uri.parse(url ?? '').toString().replaceAll('#', "%23");
} else {
modifiedUrl = Uri.parse(url ?? '').toString();
}
if (hashtags != null && hashtags.isNotEmpty) {
String tags = "";
hashtags.forEach((f) {
tags += ("%23" + f.toString() + " ").toString();
});
args = <String, dynamic>{
"captionText": captionText + "\n" + tags.toString(),
"url": modifiedUrl,
"trailingText": trailingText ?? ''
};
} else {
args = <String, dynamic>{
"captionText": captionText + " ",
"url": modifiedUrl,
"trailingText": trailingText ?? ''
};
}
final String? version = await _channel.invokeMethod('shareTwitter', args);
return version;
}