logCustomNavigation method

void logCustomNavigation({
  1. required String toPageName,
  2. String? fromPageName,
  3. required String navigationType,
  4. Map<String, dynamic>? params,
  5. Duration? stayDuration,
})

记录自定义导航事件

Implementation

void logCustomNavigation({required String toPageName, String? fromPageName, required String navigationType, Map<String, dynamic>? params, Duration? stayDuration}) {
  if (!_isSetup || _engine == null) return;
  final event = NavigationEvent(
    fromPage: fromPageName ?? 'unknown',
    toPage: toPageName,
    action: 'custom_$navigationType',
    timestamp: DateTime.now(),
    arguments: params,
    stayDuration: stayDuration,
    routeName: toPageName,
  );
  _queueEvent(event);
  try {
    SmartWidgetInterceptor.updatePageInfo(toPageName);
  } catch (e) {
    // 忽略更新错误
  }
}