- dart sdk: >=2.16.0 <3.0.0
- flutter sdk: >=2.10.0
# Qiscus Multichannel main package
flutter pub add qiscus_multichannel_widget
In order to use QiscusMultichannelWidget
, you need to initialize it with your AppID (YOUR_APP_ID
). Get more information to get AppID from Qiscus Multichannel Chat page
// Wrap your outer most component with `QMultichannelProvider`
// for example
import 'package:qiscus_multichannel_widget/qiscus_multichannel_widget.dart';
QMultichannelProvider(
appId: appId,
builder: (context) {
return MaterialApp(
home: _buildNavigator(),
);
},
);
After the initialization, you can access all the widget's functions.
Set UserId before start the chat, this is mandatory.
QMultichannelConsumer(
builder: (_, QMultichannel ref) {
ref.setUser(
userId: 'guest-1001',
displayName: 'guest-1001',
);
ref.initiateChat();
return Container();
},
),
Use this function to check whether the user has already logged in.
QMultichannelConsumer(
builder: (_, QMultichannel ref) {
if (ref.account.hasValue == true) {
// User already logged in
}
return Container();
},
),
Use this function to start a chat.
QMultichannelConsumer(
builder: (_, QMultichannel ref) {
ref.initiateChat();
return Container();
},
),
Use this function to clear the logged-in users.
QMultichannelConsumer(
builder: (_, QMultichannel ref) {
ref.clearUser();
return Container();
},
),