unregisterFromTopics static method

Future<void> unregisterFromTopics(
  1. List<String> topics
)

Unregister the current device from an array of topics, the topics are matched using the code of the topic.

@param topics The array of topics you will unregister from. @returns A future that completes once the registration is successful.

Implementation

static Future<void> unregisterFromTopics(List<String> topics) async {
  Map<String, String> apiParameters = {};
  apiParameters.addAll(await _defaultParameters());
  apiParameters['topics'] = json.encode(topics);

  String apiName = 'api/unregister';

  var requestBody = json.encode(apiParameters);

  Map<String, String> headers = _defaultHeaders(contentTypeJson: true);

  var uri = Uri.https(_endpoint, apiName);

  http.Response response = await http.post(
    uri,
    headers: headers,
    body: requestBody,
  );

  _checkResponse(response.body);
}