whistleLoopEvents function

void whistleLoopEvents(
  1. String eventName, {
  2. String extraparameters = '',
})

Implementation

void whistleLoopEvents(String eventName,{String extraparameters=''}) async {




  String? deviceId = await StagingLoop ().initDeviceId();
  String packageName = await StagingLoop ().getpac();
  String networkType = await StagingLoop ().getConnectionType();
  String ip = await StagingLoop ().getIP();
  String? userAgent = await StagingLoop ().getDeviceType();
  String clickedTime = await StagingLoop ().getTime();
  String clickedDate = await StagingLoop ().getDate();
  String platformOs = await StagingLoop ().getPlatform();
  String timeZone = await StagingLoop ().getTimezone();
  String token = WhistleLoop.token;

  var request = http.Request(
      'POST',
      Uri.parse(
          'https://utils.follow.whistle.mobi/events_sdk_app.php?device_id=$deviceId&event_name=$eventName&package_name=$packageName&network_type=$networkType&ip=$ip&user_agent=$userAgent&clicked_time=$clickedTime&clicked_date=$clickedDate&platform_os=$platformOs&time_zone=$timeZone&extraparams=$extraparameters&token=$token'));
  http.StreamedResponse response = await request.send();
  if (response.statusCode == 200) {
    debugPrint(await response.stream.bytesToString());
  } else {
    debugPrint(response.reasonPhrase);
  }
}