Flutter Plugin for TDLib (Telegram Database Library)
Telegram Tdlib is a complete library for creating telegram clients, it also has a simple tdjson ready-to-use library to ease the integration with different programming languages and platforms.
This plugin is a complete tdlib-tdjson binding package to help you create your own Telegram clients.
See the example
directory for the complete sample app.
Install the plugin by running the following command from the project root:
flutter pub add tdlib
This plugin contains only Android tdlib-tdjson library. In case of other platforms usage you need to manually put the tdjson library in your project
.so
file in your project and use it's path for initialization.web
folder in your project.tdlib.js
file in index.html
:
<!--add this between the <body> tags -->
<script src="/tdlib.js" type="application/javascript"></script>
To initialize tdlib plugin, call the initialize
method on the TdPlugin
class.
Since this is an asynchronous operation, the main function can be modified to ensure initialization is complete before running the application.
The method accepts LIBTDJSON_PATH for windows platform or LIBTDJSON_NAME for IOS & macOS.
Import tdlib
plugin:
import 'package:tdlib/tdlib.dart';
Next, within the main
function, initialize TdPlugin
:
// lib/main.dart
void main() async {
await TdPlugin.initialize();
runApp(MyApp());
}