trackScreenView method
Tracks a screen view.
Emits a screen_view event (through the normal pipeline, so it is stamped
with the active last-click attribution context) carrying the screen name
and — when available — the previously tracked screen, so the dashboard can
build a per-link screen-flow funnel.
name: Screen name (e.g., "ProductDetail")properties: Optional additional properties
Implementation
@override
Future<void> trackScreenView(
String name, [
Map<String, dynamic>? properties,
]) async {
if (name.trim().isEmpty) {
throw InvalidEventDataError('Screen name cannot be empty');
}
final previous = _lastScreen;
_lastScreen = name;
final eventProperties = Map<String, dynamic>.from(properties ?? {});
eventProperties['screen'] = name;
if (previous != null && previous != name) {
eventProperties['previousScreen'] = previous;
}
await trackEvent('screen_view', eventProperties);
}