searchLogs method
搜索导航日志
Implementation
List<Map<String, dynamic>> searchLogs({
String? action,
String? navigationType,
String? fromPage,
String? toPage,
DateTime? startTime,
DateTime? endTime,
}) {
return _navigationLogs.where((log) {
if (action != null && log['action'] != action) return false;
if (navigationType != null && log['navigationType'] != navigationType) return false;
if (fromPage != null && log['fromPage'] != fromPage) return false;
if (toPage != null && log['toPage'] != toPage) return false;
if (startTime != null || endTime != null) {
final timestamp = log['timestamp'] as int;
final logTime = DateTime.fromMillisecondsSinceEpoch(timestamp);
if (startTime != null && logTime.isBefore(startTime)) return false;
if (endTime != null && logTime.isAfter(endTime)) return false;
}
return true;
}).toList();
}