send method

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

Implementation

Future<void> send(String? url) async {
  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("ImpressionApi").i('GET request successful');
      } else {
        // Request failed
        Log("ImpressionApi").i('GET request failed with status: ${response.statusCode}');
      }
    } catch(e) {
      Log("ImpressionApi").i('Error: $e');
    }
  }
}