send method

Future<void> send(
  1. String? url
)

Implementation

Future<void> send(String? url) async {
  Log("ViewAbilityApi").i("url: $url");
  if (url != null) {
    final currentTime = DateTime.now().millisecondsSinceEpoch;
    url = url.replaceAll("{{EVENT_CLIENT_TIME}}", '$currentTime');
    try {
      // Make the GET request
      final response = await http.get(Uri.parse(url));

      if (response.statusCode == 200) {
        // Request was successful
        Log("ViewAbilityApi").i('GET request successful: ${response.statusCode}');
      } else {
        // Request failed
        Log("ViewAbilityApi").i('GET request failed with status: ${response.statusCode}');
      }
    } catch(e) {
      Log("ViewAbilityApi").i('Error: $e');
    }
  }
}