atlas_support_sdk 0.0.1
atlas_support_sdk: ^0.0.1 copied to clipboard
Atlas customer support chat widget
Atlas customer support chat widget
Getting started #
To use it with Android you may need to ensure that AndroidManifest.xml includes <uses-permission android:name="android.permission.INTERNET" />
Usage #
Using the widget to add the chat
import 'package:atlas_support_sdk/atlas_support_widget.dart';
// Use widget:
AtlasSupportWidget(appId: "", userId: "", userHash: "")
Listening for stats changes
import 'package:atlas_support_sdk/watch_atlas_support_stats.dart';
// Listen:
class _MyWidgetState extends State<MyWidget> {
int _unreadCount = 0;
Function? _unsubscribe = null;
@override
void initState() {
super.initState();
_unsubscribe = watchAtlasSupportStats(
appId: "",
userId: "",
userHash: "",
onStatsChange: (stats) {
setState(() {
_unreadCount = stats['conversations']
.fold(0, (sum, conversation) => sum + conversation['unread']);
});
});
}
@override
void dispose() {
_unsubscribe?.call();
super.dispose();
}
// ...
}