logPerformanceEvent static method
Logs performance event with params:
navigationType
the navigation type, Default NAVIGATE = 0, RELOAD = 1, BACK_FORWARD = 2, RESERVED = 255
redirectCount
the redirect count, Default 0
navigationStart
the navigation start time - Default 0
unloadEventStart
the unload event start time - Default 0, onDestroy
unloadEventEnd
the unload event end time - Time ending from unloadStart
redirectStart
the redirect start time - Default 0
redirectEnd
the redirect end time - Time ending from redirectStart
loadEventStart
the load event start time - Default 0, onCreate
loadEventEnd
the load event end time - End time of loading page, onResume
Returns true if log performance event succeed, false otherwise
Implementation
static Future<bool> logPerformanceEvent(
{final int navigationType = 0,
final int redirectCount = 0,
final int navigationStart = 0,
final int unloadEventStart = 0,
final int unloadEventEnd = 0,
final int redirectStart = 0,
final int redirectEnd = 0,
final int loadEventStart = 0,
final int loadEventEnd = 0}) async {
try {
if (navigationType < 0) {
throw ArgumentError("navigationType must be positive");
}
if (redirectCount < 0) {
throw ArgumentError("redirectCount must be positive");
}
if (navigationStart < 0) {
throw ArgumentError("navigationStart must be positive");
}
if (unloadEventStart < 0) {
throw ArgumentError("navigationType must be positive");
}
if (unloadEventEnd < 0) {
throw ArgumentError("unloadEventStart must be positive");
}
if (redirectStart < 0) {
throw ArgumentError("redirectStart must be positive");
}
if (redirectEnd < 0) throw ArgumentError("redirectEnd must be positive");
if (loadEventStart < 0) {
throw ArgumentError("loadEventStart must be positive");
}
if (loadEventEnd < 0) {
throw ArgumentError("loadEventEnd must be positive");
}
return await _channel.invokeMethod('logPerformanceEvent',
<dynamic, dynamic>{
'navigationType': navigationType.toString(),
'redirectCount': redirectCount.toString(),
'navigationStart': navigationStart.toString(),
'unloadEventStart': unloadEventStart.toString(),
'unloadEventEnd': unloadEventEnd.toString(),
'redirectStart': redirectStart.toString(),
'redirectEnd': redirectEnd.toString(),
'loadEventStart': loadEventStart.toString(),
'loadEventEnd': loadEventEnd.toString()
});
} on PlatformException catch (pe) {
throw TealeafException(
pe, msg: 'Unable to process log performance event message!');
}
}