getConnectorsFromSealdId method

List<SealdConnector> getConnectorsFromSealdId(
  1. String sealdId
)

List all connectors known locally for a given Seald ID.

sealdId - The Seald ID for which to list connectors. Returns a SealdConnectorsArray instance.

Implementation

List<SealdConnector> getConnectorsFromSealdId(String sealdId) {
  if (_closed) {
    throw SealdException(
        code: "INSTANCE_CLOSED",
        id: "FLUTTER_INSTANCE_CLOSED",
        description: "Instance already closed.");
  }
  final Pointer<Utf8> nativeSealdId = sealdId.toNativeUtf8();
  final Pointer<Pointer<NativeSealdConnectorsArray>> result =
      calloc<Pointer<NativeSealdConnectorsArray>>();
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();

  final int resultCode = _bindings.SealdSdk_GetConnectorsFromSealdId(
      _ptr.pointer(), nativeSealdId, result, err);

  calloc.free(nativeSealdId);

  if (resultCode != 0) {
    calloc.free(result);
    throw SealdException._fromCPtr(err);
  } else {
    final List<SealdConnector> res = SealdConnector._fromCArray(result.value);
    calloc.free(result);
    calloc.free(err);
    return res;
  }
}