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