telegram_client 0.5.8 copy "telegram_client: ^0.5.8" to clipboard
telegram_client: ^0.5.8 copied to clipboard

Telegram Client Lightweight, blazing and Highly customizable for make application telegram based tdlib, mtproto, or bot api and support server side.

example/lib/main.dart

// ignore_for_file: unused_local_variable, avoid_print

import 'package:flutter/material.dart';
import 'package:telegram_client/alfred/alfred.dart';
import "package:telegram_client/telegram_client.dart";

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  Alfred alfred = Alfred();
  try {
    alfred.all("/", (req, res) => null);
    await alfred.listen();
  } catch (e) {
    print(e);
  }
  TelegramBotApi telegramBotApi =
      TelegramBotApi(tokenBot: "tokenBot", alfred: alfred);
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
155
likes
0
points
2.64k
downloads

Publisher

unverified uploader

Weekly Downloads

Telegram Client Lightweight, blazing and Highly customizable for make application telegram based tdlib, mtproto, or bot api and support server side.

Homepage
Repository (GitHub)
View/report issues

Topics

#telegram #tdlib #mtproto #userbot #telegram-bot-api

Documentation

Documentation

Funding

Consider supporting this project:

github.com

License

unknown (license)

Dependencies

alfred, ffi, galaxeus_lib, http, mason_logger, path, universal_io, web_ffi

More

Packages that depend on telegram_client