getStatusColor method

Color? getStatusColor(
  1. Device device
)

Returns the appropriate status icon for the log messages received from device

Implementation

Color? getStatusColor(Device device) {
  final socket = models.sockets.socketForDevice(device);
  final lowestLevel = model.getSeverity(device);
  if (socket == null || !socket.isConnected) return Colors.black;
  return switch (lowestLevel) {
    BurtLogLevel.critical => Colors.red,
    BurtLogLevel.info || BurtLogLevel.debug || BurtLogLevel.trace => Colors.green,
    BurtLogLevel.warning => Colors.yellow,
    BurtLogLevel.error => Colors.red,
    _ => null,
  };
}