onNewLog method

void onNewLog()

Scrolls to the bottom when a new log appears (if LogsOptionsViewModel.autoscroll is true).

Implementation

void onNewLog() {
  if (options.paused && models.logs.logsForDevice(options.deviceFilter)!.isNotEmpty) return;
  notifyListeners();
  final log = models.logs.allLogs.lastOrNull;
  if (log == null) {
    return;
  }
  if (!log.level.isAtLeast(options.levelFilter)) {
    return;
  }
  if (options.deviceFilter != null && log.device != options.deviceFilter) {
    return;
  }
  if (!scrollController.hasClients) return;
  scrollController.jumpTo(options.autoscroll ? 0 : scrollController.offset + 67);
}