getNavigationFlow method
获取导航流程分析
Implementation
Map<String, dynamic> getNavigationFlow() {
if (_navigationLogs.isEmpty) {
return {'flows': [], 'totalFlows': 0};
}
final flows = <String>[];
for (int i = 0; i < _navigationLogs.length - 1; i++) {
final current = _navigationLogs[i];
final next = _navigationLogs[i + 1];
if (current['action'] == 'push' && next['action'] == 'push') {
final flow = '${current['toPage']} -> ${next['toPage']}';
flows.add(flow);
}
}
// 统计流程频率
final flowCounts = <String, int>{};
for (final flow in flows) {
flowCounts[flow] = (flowCounts[flow] ?? 0) + 1;
}
return {
'flows': flowCounts,
'totalFlows': flows.length,
'uniqueFlows': flowCounts.length,
};
}