updatePrinterStatus method
Implementation
void updatePrinterStatus(String status, String color) {
if (selectedAddress != null) {
Color newColor = Colors.grey.withOpacity(0.6);
switch (color) {
case 'R':
newColor = Colors.red;
break;
case 'G':
newColor = Colors.green;
break;
default:
newColor = Colors.grey.withOpacity(0.6);
break;
}
final int index =
_printers.indexWhere((element) => element.address == selectedAddress);
_printers[index] = _printers[index].copyWith(
status: status,
color: newColor,
isConnected: printers[index].address == selectedAddress);
notifyListeners();
}
}