closeSpotCheck method

void closeSpotCheck()

Implementation

void closeSpotCheck() async {
  try {
    Map<String, dynamic> payload = {
      "traceId": traceId.value,
      "triggerToken": triggerToken.value
    };

    final response = await http.put(
      Uri.parse(
          "https://$domainName/api/internal/spotcheck/dismiss/$spotcheckContactID"),
      headers: <String, String>{
        'Content-Type': 'application/json',
      },
      body: jsonEncode(payload),
    );

    if (response.statusCode == 200) {
      final Map<String, dynamic> data = jsonDecode(response.body);
      if (data["success"]) {
        log("SpotCheck Closed");
      }
    }
  } catch (error) {
    log("Error parsing JSON: $error");
  }
}