loadWalletSync function

void loadWalletSync({
  1. required String path,
  2. required String password,
  3. int nettype = 0,
})

Implementation

void loadWalletSync(
    {required String path, required String password, int nettype = 0}) {
  final pathPointer = path.toNativeUtf8().cast<Char>();
  final passwordPointer = password.toNativeUtf8().cast<Char>();
  final errorBoxPointer = monero_flutter.buildErrorBoxPointer();

  monero_flutter.bindings
      .load_wallet(pathPointer, passwordPointer, nettype, errorBoxPointer);
  final errorInfo = monero_flutter.extractErrorInfo(errorBoxPointer);

  calloc.free(pathPointer);
  calloc.free(passwordPointer);

  if (0 != errorInfo.code) {
    throw WalletRestoreFromKeysException(message: errorInfo.getErrorMessage());
  }
}