chatsasa_livechat 1.0.1
chatsasa_livechat: ^1.0.1 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';
import 'package:chatsasa_livechat/src/presentation/chat/widget_info.dart';
import 'package:chatsasa_livechat/src/presentation/common/app_user_model.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) {
var appUser = AppUserModel(
name: 'Joe',
email: 'joe@gmail.com',
userIdentifier: 'joe@gmail.com',
);
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
appUserModel: appUser
)));
},
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.