removeConnector method

SealdConnector removeConnector(
  1. String connectorId
)

Remove a connector belonging to the current account.

connectorId - The ID of the connector to remove. Returns the removed SealdConnector instance.

Implementation

SealdConnector removeConnector(String connectorId) {
  if (_closed) {
    throw SealdException(
        code: "INSTANCE_CLOSED",
        id: "FLUTTER_INSTANCE_CLOSED",
        description: "Instance already closed.");
  }
  final Pointer<Utf8> nativeConnectorId = connectorId.toNativeUtf8();
  final Pointer<Pointer<NativeSealdConnector>> result =
      calloc<Pointer<NativeSealdConnector>>();
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();

  final int resultCode = _bindings.SealdSdk_RemoveConnector(
      _ptr.pointer(), nativeConnectorId, result, err);

  calloc.free(nativeConnectorId);

  if (resultCode != 0) {
    calloc.free(result);
    throw SealdException._fromCPtr(err);
  } else {
    final SealdConnector c = SealdConnector._fromC(result.value);
    calloc.free(result);
    calloc.free(err);
    return c;
  }
}