Run dart format

This commit is contained in:
zjs81
2026-03-07 13:01:27 -07:00
parent e1327a93c7
commit b2da695102
6 changed files with 53 additions and 55 deletions
+1 -4
View File
@@ -906,10 +906,7 @@ class MeshCoreConnector extends ChangeNotifier {
try {
await _usbFrameSubscription?.cancel();
_usbFrameSubscription = null;
_appDebugLogService?.info(
'connectUsb: opening serial port…',
tag: 'USB',
);
_appDebugLogService?.info('connectUsb: opening serial port…', tag: 'USB');
await _usbManager.connect(portName: portName, baudRate: baudRate);
_appDebugLogService?.info(
'connectUsb: serial port opened, label=${_usbManager.activePortDisplayLabel}',
+5 -3
View File
@@ -24,8 +24,7 @@ class MeshCoreUsbManager {
// --- Configuration ---
Future<List<String>> listPorts() => _service.listPorts();
void setRequestPortLabel(String label) =>
_service.setRequestPortLabel(label);
void setRequestPortLabel(String label) => _service.setRequestPortLabel(label);
void setFallbackDeviceName(String label) =>
_service.setFallbackDeviceName(label);
@@ -36,7 +35,10 @@ class MeshCoreUsbManager {
}
// --- Connection lifecycle ---
Future<void> connect({required String portName, int baudRate = 115200}) async {
Future<void> connect({
required String portName,
int baudRate = 115200,
}) async {
_debugLog?.info(
'UsbManager.connect: portName=$portName baud=$baudRate',
tag: 'USB',
+8 -6
View File
@@ -107,7 +107,8 @@ class _UsbScreenState extends State<UsbScreen> {
bottomNavigationBar: Consumer<MeshCoreConnector>(
builder: (context, connector, child) {
final isLoading = _isLoadingPorts;
final showBle = PlatformInfo.isWeb ||
final showBle =
PlatformInfo.isWeb ||
PlatformInfo.isAndroid ||
PlatformInfo.isIOS;
@@ -238,7 +239,7 @@ class _UsbScreenState extends State<UsbScreen> {
final isConnecting =
connector.state == MeshCoreConnectionState.connecting &&
connector.activeTransport == MeshCoreTransportType.usb;
connector.activeTransport == MeshCoreTransportType.usb;
return ListView.separated(
padding: const EdgeInsets.all(8),
@@ -259,8 +260,7 @@ class _UsbScreenState extends State<UsbScreen> {
),
subtitle: showRawName ? Text(rawName) : null,
trailing: ElevatedButton(
onPressed:
isConnecting ? null : () => _connectPort(port),
onPressed: isConnecting ? null : () => _connectPort(port),
child: Text(l10n.common_connect),
),
onTap: isConnecting ? null : () => _connectPort(port),
@@ -329,8 +329,10 @@ class _UsbScreenState extends State<UsbScreen> {
if (_connector.state != MeshCoreConnectionState.disconnected) return;
final rawPortName = normalizeUsbPortName(port);
appLogger.info('Connect tapped for $port (raw: $rawPortName)',
tag: 'UsbScreen');
appLogger.info(
'Connect tapped for $port (raw: $rawPortName)',
tag: 'UsbScreen',
);
try {
await _connector.connectUsb(portName: rawPortName);
+1 -2
View File
@@ -101,8 +101,7 @@ class NotificationService {
final addr = Platform.environment['DBUS_SESSION_BUS_ADDRESS'];
if (addr != null && addr.isNotEmpty) return true;
// Fallback: check the default socket for the current user.
final uid = Platform.environment['UID'] ??
Platform.environment['EUID'];
final uid = Platform.environment['UID'] ?? Platform.environment['EUID'];
final path = '/run/user/${uid ?? '1000'}/bus';
return File(path).existsSync();
}
+2 -8
View File
@@ -118,10 +118,7 @@ class UsbSerialService {
tag: 'USB Serial',
);
} catch (error) {
_debugLogService?.error(
'Web connect failed: $error',
tag: 'USB Serial',
);
_debugLogService?.error('Web connect failed: $error', tag: 'USB Serial');
await _cleanupFailedConnect();
_status = UsbSerialStatus.disconnected;
_connectedPortName = null;
@@ -374,10 +371,7 @@ class UsbSerialService {
}
}
} catch (error, stackTrace) {
_debugLogService?.error(
'_pumpReads error: $error',
tag: 'USB Serial',
);
_debugLogService?.error('_pumpReads error: $error', tag: 'USB Serial');
if (_status == UsbSerialStatus.connected) {
_addFrameError(error, stackTrace);
}