trackWidgetEnd method
Tracks when a widget has ended.
If the widget doesn't exist, it doesn't do anything.
May throw Exception on native platform contingency.
Implementation
Future<void> trackWidgetEnd(String widgetName) async {
try {
final trackedWidget = trackedWidgets[widgetName];
if (trackedWidget == null) {
return;
}
final endDate = DateTime.now().millisecondsSinceEpoch;
trackedWidget.endDate = endDate;
await channel.invokeMethod<void>('trackPageEnd', trackedWidget.toJson());
trackedWidgets.remove(trackedWidget.widgetName);
} on PlatformException catch (e) {
throw Exception(e.details);
}
}