sceyt_chat 0.0.2 copy "sceyt_chat: ^0.0.2" to clipboard
sceyt_chat: ^0.0.2 copied to clipboard

SceytChat flutter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:sceyt_chat/connection/connection_state.dart' as chat;
import 'package:sceyt_chat/sceyt_chat.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  chat.ConnectionState? _connectionState;
  final _chatClient = SceytChatClient();

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

    initChatClient();
  }

  void initChatClient() {
    _chatClient.initChatClient("api  ", "appId", "clientId");
    setConnectionStateChangeListener();
  }

  void setConnectionStateChangeListener() {
    _chatClient.addConnectionStateListener((chat.ConnectionState state) {
      onConnectionStateChanged(state);
    });
  }

  void onConnectionStateChanged(chat.ConnectionState state) {
    setState(() {
      _connectionState = state;
    });
  }

  void _onButtonClick() {
    _chatClient.connectChatClient("token");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text(_connectionState?.name ?? "Test APP")),
        body: Center(
          child: FloatingActionButton(
            onPressed: _onButtonClick,
            tooltip: 'Increment',
            child: const Icon(Icons.add),
          ),
        ),
      ),
    );
  }
}
1
likes
130
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

SceytChat flutter.

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on sceyt_chat

Packages that implement sceyt_chat