createWalletSync function

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

Implementation

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

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

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

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