create static method
Future<ChatwootClient>
create({
- required String baseUrl,
- required String inboxIdentifier,
- ChatwootUser? user,
- bool enablePersistence = true,
- ChatwootCallbacks? callbacks,
Creates an instance of ChatwootClient with the baseUrl of your chatwoot installation,
inboxIdentifier for the targeted inbox. Specify custom user details using user and callbacks for
handling chatwoot events. By default persistence is enabled, to disable persistence set enablePersistence as false
Implementation
static Future<ChatwootClient> create(
{required String baseUrl,
required String inboxIdentifier,
ChatwootUser? user,
bool enablePersistence = true,
ChatwootCallbacks? callbacks}) async {
if (enablePersistence) {
await LocalStorage.openDB();
}
final chatwootParams = ChatwootParameters(
clientInstanceKey: getClientInstanceKey(
baseUrl: baseUrl,
inboxIdentifier: inboxIdentifier,
userIdentifier: user?.identifier),
isPersistenceEnabled: enablePersistence,
baseUrl: baseUrl,
inboxIdentifier: inboxIdentifier,
userIdentifier: user?.identifier);
final client =
ChatwootClient._(chatwootParams, callbacks: callbacks, user: user);
client._init();
return client;
}