setApiKey static method

Future<BaseResponse> setApiKey(
  1. String apiKey
)

Sets Appmate apiKey

Api key can be retrieved from Appmate Portal via navigating to application page.

apiKey Unique identifier for using Appmate services.

Callbacks BaseResponse and GenericError in case of failure.

Implementation

static Future<BaseResponse> setApiKey(String apiKey) async {
  List<Object?>? response =
      await _channel.invokeMethod('setApiKey', {"apiKey": apiKey});
  BaseResponse result = new BaseResponse(false, null);
  if (response != null) {
    if (response[0] != null) {
      result = new BaseResponse(response[0].toString() == "true", null);
    }
    if (response[1] != null) {
      GenericError error =
          GenericError.fromJson(json.decode(response[1]!.toString()));
      result = new BaseResponse(false, error);
    }
    return result;
  }
  return result;
}