im_plugin_tencent_web 0.0.3 copy "im_plugin_tencent_web: ^0.0.3" to clipboard
im_plugin_tencent_web: ^0.0.3 copied to clipboard

Platformweb

The Flutter plugin integrated with Tencent IM is only for the web end and can be used for chat chat and call audio and video calls. Chat chat only connects to Tencent IM's UI free access method, provi [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:im_plugin_tencent_web/im/event_listener_config.dart';

import 'package:im_plugin_tencent_web/im_plugin_tencent_web.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('腾讯 IM WEB 插件测试')),
        body: Padding(
          padding: EdgeInsets.only(left: 10, right: 10,),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              MaterialButton(
                onPressed: () {
                  ImPluginTencentWeb.initSdk(
                    sdkAppID: 1600152723,
                    eventListener: EventListenerConfig(
                      onSdkReady: (event) {
                        print('>>>>>>>>>>>> onSdkReady');
                      },
                    ),
                  );
                },
                child: Text('初始化腾讯IM'),
              ),
              MaterialButton(
                onPressed: () async {
                  try {
                    final imLoginRes = await ImPluginTencentWeb.login(
                      userID: '2064644640146649090',
                      userSig: 'eJw1jc0OgjAQhN*lZ0N2S9kCiQe9ykGCB66YVtwopBYCGuO72wgmc5qfb97iVFQRG9uPfGHrRS4kkCIVBKiIVAYZiM2vZp*OvRW51poAYDEHbsOIDDbtdCfqz8fZzLWvWTZ73D2GwuHLS3XtqrIqDtyW25U2LW-Rnz5yF9ioU5WgSuNsxZtb4xybkIRPTKSW8ecLlSYzhQ__',
                    );
                    print(imLoginRes);
                  } catch(err) {
                    print('登录出错:$err');
                  }
                },
                child: Text('登录腾讯IM'),
              ),
              MaterialButton(
                onPressed: () async {
                  try {
                    final imLogoutRes = await ImPluginTencentWeb.logout();
                    print(imLogoutRes);
                  } catch(err) {
                    print('登出出错:$err');
                  }
                },
                child: Text('登出腾讯IM'),
              ),
              MaterialButton(
                onPressed: () async {
                  try {
                    await ImPluginTencentWeb.destroy();
                  } catch(err) {
                    print('销毁出错:$err');
                  }
                },
                child: Text('销毁腾讯IM'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
145
points
181
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

The Flutter plugin integrated with Tencent IM is only for the web end and can be used for chat chat and call audio and video calls. Chat chat only connects to Tencent IM's UI free access method, providing available methods. Your Flutter side needs to determine whether to integrate and use this plugin only for the web version

Repository

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on im_plugin_tencent_web

Packages that implement im_plugin_tencent_web