flutter_telegram_login 0.0.2 flutter_telegram_login: ^0.0.2 copied to clipboard
A Flutter package that implements the required function in order to login with Telegram.
flutter_telegram_login #
A Flutter plugin providing the required functions in order to implement login with Telegram.
Usage #
To use this plugin, add flutter_telegram_login
as a dependency in your pubspec.yaml file.
Example #
import 'package:flutter/material.dart';
import 'package:flutter_telegram_login/flutter_telegram_login.dart';
final TelegramLogin telegramLogin = TelegramLogin(<PHONE_NUMBER:String>, <BOT_ID:String>, <BOT_DOMAIN:String>);
void main() => runApp(
MaterialApp(
home: Material(
child: Center(
child: Column(
children: [
ElevatedButton(
onPressed: telegramLogin.loginTelegram,
child: const Text("loginTelegram")
),
ElevatedButton(
onPressed: () async {
var success = await telegramLogin.checkLogin();
print(success);
},
child: const Text("checkLogin")
),
ElevatedButton(
onPressed: () async {
var data = await telegramLogin.getData();
print(data);
if (data) {
print(telegramLogin.userData);
}
},
child: const Text("getData")
),
ElevatedButton(
onPressed: () async {
await telegramLogin.telegramLaunch();
},
child: const Text("openTelegram")
),
]
)
)
)
)
);