toMap method
Implementation
Map<String, dynamic> toMap() {
final date = DateTime.now();
return {
'apiVersion': "1.0",
'counterId' : counterId ?? '',
'timestamp': date.toUtc().millisecondsSinceEpoch.toString(),
'channelType': "CustomScript",
'channelName' : "RegEvents API",
'eventCaption': eventType ?? '',
'customparams': [
{
if(latitude != null) 'latitude': latitude,
if(longitude != null) 'longitude': longitude,
if(osName != null) 'os_name': osName,
if(deviceName != null) 'device_name': deviceName,
if(libraryVersion != null) 'library': libraryVersion,
if(ipAddress != null) 'ip_address': ipAddress,
if(deviceId != null) 'device_id': deviceId,
if(userId != null) 'user_id': userId,
if(sessionId != null) 'session_id': sessionId,
if(appScreen != null) 'app_screen': appScreen,
if(osVersion != null) 'os_version': osVersion,
if(appVersion != null) 'release_version': appVersion,
if(appName != null) 'app_name': appName,
if(platform != null) 'platform': platform,
if(language != null) 'language': language,
if(resolutionWidth != null) 'resolution_width': resolutionWidth,
if(resolutionHeight != null) 'resolution_height': resolutionHeight,
'time_zone': date.timeZoneName,
...?customParam,
}
]
};
}