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