close method

void close()

Close the current SDK instance. This frees any lock on the current database, and frees the memory. After calling close, the instance cannot be used anymore.

Implementation

void close() {
  if (_closed) {
    throw SealdException(
        code: "INSTANCE_CLOSED",
        id: "FLUTTER_INSTANCE_CLOSED",
        description: "Instance already closed.");
  }
  _closed = true;
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();
  final int resultCode = _bindings.SealdSdk_Close(_ptr.pointer(), err);
  if (resultCode != 0) {
    throw SealdException._fromCPtr(err);
  } else {
    calloc.free(err);
  }
}