retrieveConnector method

SealdConnector retrieveConnector(
  1. String connectorId
)

Retrieve a connector by its connectorId, then updates the local cache of connectors.

connectorId - The ID of the connector to retrieve. Returns the retrieved SealdConnector instance.

Implementation

SealdConnector retrieveConnector(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_RetrieveConnector(
      _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;
  }
}