createClient static method

Future<void> createClient(
  1. String currentAtSign,
  2. String? namespace,
  3. AtClientPreference preferences
)

Implementation

static Future<void> createClient(String currentAtSign, String? namespace,
    AtClientPreference preferences) async {
  currentAtSign = AtUtils.formatAtSign(currentAtSign)!;
  if (_atClientInstanceMap.containsKey(currentAtSign)) {
    return;
  }
  if (preferences.isLocalStoreRequired) {
    var storageManager = StorageManager(preferences);
    await storageManager.init(currentAtSign, preferences.keyStoreSecret);
  }
  var atClientImpl = AtClientImpl(currentAtSign, namespace, preferences);
  await atClientImpl._init();
  atClientImpl.logger
      .info('AtClient init  done for : ${atClientImpl.currentAtSign}');
  _atClientInstanceMap[currentAtSign] = atClientImpl;
}