onSdkInit method

Future<void> onSdkInit(
  1. Future<void> sdkInit()
)

Implementation

Future<void> onSdkInit(Future<void> Function() sdkInit) async {
  try {
    if (getIt.currentScopeName == walletScope) {
      await getIt.resetScope();
    } else {
      getIt.pushNewScope(scopeName: walletScope);
    }
    await sdkInit();
  } catch (e, s) {
    if (getIt.currentScopeName == walletScope) {
      await getIt.resetScope();
    }
    Logar.error(
      'Exception in wallet dependency injection',
      tag: 'WALLET_INJECTOR',
      error: s,
      stackTrace: s,
    );
    Logar.error(
      'Secondary exception in wallet dependency injection',
      tag: 'WALLET_INJECTOR',
      error: e,
      stackTrace: StackTrace.current,
    );
  }
}