getSealdIdsFromConnectors method

List<String> getSealdIdsFromConnectors(
  1. List<SealdConnectorTypeValue> connectorTypeValues
)

Get all the info for the given connectors to look for, updates the local cache of connectors, and returns a list with the corresponding Seald IDs. Seald IDs are not de-duped and can appear for multiple connector values. If one of the connectors is not assigned to a Seald user, this will throw a SealdException with the details of the missing connector.

connectorTypeValues - A List of SealdConnectorTypeValue instances. Returns a list of Seald IDs of the users corresponding to these connectors.

Implementation

List<String> getSealdIdsFromConnectors(
    List<SealdConnectorTypeValue> connectorTypeValues) {
  if (_closed) {
    throw SealdException(
        code: "INSTANCE_CLOSED",
        id: "FLUTTER_INSTANCE_CLOSED",
        description: "Instance already closed.");
  }
  final Pointer<NativeSealdConnectorTypeValueArray>
      nativeConnectorTypeValues =
      SealdConnectorTypeValue._toCArray(connectorTypeValues);
  final Pointer<Pointer<NativeSealdStringArray>> result =
      calloc<Pointer<NativeSealdStringArray>>();
  final Pointer<Pointer<NativeSealdError>> err =
      calloc<Pointer<NativeSealdError>>();

  final int resultCode = _bindings.SealdSdk_GetSealdIdsFromConnectors(
      _ptr.pointer(), nativeConnectorTypeValues, result, err);

  _bindings.SealdConnectorTypeValueArray_Free(nativeConnectorTypeValues);

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