qichatsdk_flutter 2.0.0 copy "qichatsdk_flutter: ^2.0.0" to clipboard
qichatsdk_flutter: ^2.0.0 copied to clipboard

A useful Dart library for QiChat.

example/qichatsdk_flutter_example.dart

import 'dart:ffi';

import 'package:fixnum/src/int64.dart';
import 'package:qichatsdk_flutter/qichatsdk_flutter.dart';
import 'package:qichatsdk_flutter/src/ChatLib.dart';
import 'package:qichatsdk_flutter/src/LineDetect.dart';
import 'package:web_socket_channel/web_socket_channel.dart';

import 'MyChatListener.dart';

void main() {
  // Create an instance of ChatLib
  final chatLib = ChatLib();

  // Create an instance of your listener
  final listener = MyChatListener();

  // Assign the listener to the ChatLib delegate
  chatLib.delegate = listener;

  // Initialize the chat library with necessary parameters
  chatLib.initialize(
    userId: 230,
    cert: "COYBEAUYASDyASiG2piD9zE.te46qua5ha2r-Caz03Vx2JXH5OLSRRV2GqdYcn9UslwibsxBSP98GhUKSGEI0Z84FRMkp16ZK8eS-y72QVE2AQ",
    token: "",
    baseUrl: "wss://csapi.hfxg.xyz/v1/gateway/h5",
    sign: "9zgd9YUc",
  );

  // Now the listener will receive the delegate events
  chatLib.callWebSocket();
}