telegram_share static method

String telegram_share({
  1. required String text,
  2. required String url,
})

convert messages_api to messages_api_tdlib example:

String telegram_share = TgUtils.telegram_share(text: "slebew", url: "hi"); // result: https://t.me/share/url?url=hi&text=slebew

Implementation

static String telegram_share({
  required String text,
  required String url,
}) {
  final Map<String, String> queryParameters = {
    "url": url,
    "text": text,
  };
  queryParameters.removeWhere((key, value) => value.isEmpty);

  return Uri.parse("https://t.me/share/url")
      .replace(queryParameters: queryParameters)
      .toString();
}