create static method
Future<AtClient>
create(
- String currentAtSign,
- String? namespace,
- AtClientPreference preferences, {
- AtClientManager? atClientManager,
- RemoteSecondary? remoteSecondary,
- EncryptionService? encryptionService,
- SecondaryKeyStore? localSecondaryKeyStore,
- AtChops? atChops,
- AtClientCommitLogCompaction? atClientCommitLogCompaction,
- AtClientConfig? atClientConfig,
Implementation
static Future<AtClient> create(
String currentAtSign, String? namespace, AtClientPreference preferences,
{AtClientManager? atClientManager,
RemoteSecondary? remoteSecondary,
EncryptionService? encryptionService,
SecondaryKeyStore? localSecondaryKeyStore,
AtChops? atChops,
AtClientCommitLogCompaction? atClientCommitLogCompaction,
AtClientConfig? atClientConfig}) async {
atClientManager ??= AtClientManager.getInstance();
currentAtSign = AtUtils.fixAtSign(currentAtSign);
// Fetch cached AtClientImpl for re-use, or create a new one and init it
AtClientImpl? atClientImpl;
if (atClientInstanceMap.containsKey(currentAtSign)) {
atClientImpl = atClientInstanceMap[currentAtSign];
} else {
atClientImpl = AtClientImpl._(
currentAtSign, namespace, preferences, atClientManager,
remoteSecondary: remoteSecondary,
encryptionService: encryptionService,
localSecondaryKeyStore: localSecondaryKeyStore,
atChops: atChops,
atClientCommitLogCompaction: atClientCommitLogCompaction,
atClientConfig: atClientConfig);
await atClientImpl._init();
}
await atClientImpl!._startCompactionJob();
atClientManager.listenToAtSignChange(atClientImpl);
atClientInstanceMap[currentAtSign] = atClientImpl;
return atClientInstanceMap[currentAtSign];
}