chatsasa_livechat 1.0.0 copy "chatsasa_livechat: ^1.0.0" to clipboard
chatsasa_livechat: ^1.0.0 copied to clipboard

A live-chat customer support flutter sdk

ChatSasa Live-Chat SDK #

Welcome to the ChatSasa Flutter SDK! This SDK allows you to easily integrate ChatSasa's live chat functionality into your Flutter mobile applications.

Getting started #

TODO: List prerequisites and provide or point to information on how to start using the package.

Add dependency #

Add this to your package's pubspec.yaml file, use the latest version [![Pub]

dependencies:
 chatsasa_livechat: ^latest_version

You should then run flutter packages get

Changelog #

Check out the changelog on pub.flutter-io.cn to see the latest changes in the package.

Initialization #

Initialize the ChatSasa SDK in your main.dart file:

import 'package:flutter/material.dart';
import 'package:chatsasa_flutter_sdk/chatsasa_flutter_sdk.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  var chatSDK = ChatSasaLiveChat();
  chatSDK.initSDK();
  runApp(const MyApp());
}

Usage #

To launch the chat widget, use the following code in your main widget file:

import 'package:flutter/material.dart';
import 'package:chatsasa_flutter_sdk/chatsasa_flutter_sdk.dart';

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.blue,
        title: Text(
          "Live Chat Example",
          style: const TextStyle(color: Colors.white),
        ),
      ),
      body: Center(
        child: Container(),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          Navigator.push(
              context,
              MaterialPageRoute(
                  builder: (_) => WidgetHome(
                        widgetId: "YOUR_WIDGET_UUID",  // Replace with your widget UUID 
                      )));
        },
        tooltip: 'launch live chat',
        child: const Icon(Icons.chat_bubble_outline),
      ),
    );
  }
}

Example App #

This repository includes a fully functional example app with setup instructions. The example is available under the example folder.