From 7bbf23fa05a9bc3e57021eb9cad567db5a13aafe Mon Sep 17 00:00:00 2001 From: muskrat34 Date: Mon, 9 Mar 2026 13:53:46 -0400 Subject: [PATCH] fix: resolve build errors with Flutter 3.41 / Dart 3.11 --- .gitignore | 3 +++ .../lib/src/keypress_simulator_method_channel.dart | 7 +++++-- lib/bluetooth/devices/zwift/ftms_mdns_emulator.dart | 3 ++- lib/bluetooth/devices/zwift/zwift_device.dart | 3 ++- lib/utils/keymap/apps/custom_app.dart | 3 ++- lib/utils/keymap/manager.dart | 9 +++------ 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 2a55b3a1..bd4c8ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,6 @@ service-account.json .env lib/generated pubspec_overrides.yaml + +# FVM Version Cache +.fvm/ \ No newline at end of file diff --git a/keypress_simulator/packages/keypress_simulator_platform_interface/lib/src/keypress_simulator_method_channel.dart b/keypress_simulator/packages/keypress_simulator_platform_interface/lib/src/keypress_simulator_method_channel.dart index 867be0e1..fa4f23f0 100644 --- a/keypress_simulator/packages/keypress_simulator_platform_interface/lib/src/keypress_simulator_method_channel.dart +++ b/keypress_simulator/packages/keypress_simulator_platform_interface/lib/src/keypress_simulator_method_channel.dart @@ -40,13 +40,13 @@ class MethodChannelKeyPressSimulator extends KeyPressSimulatorPlatform { }) async { PhysicalKeyboardKey? physicalKey = key is PhysicalKeyboardKey ? key : null; if (key is LogicalKeyboardKey) { - physicalKey = key.physicalKey; + physicalKey = PhysicalKeyboardKey(key.keyId); } if (key != null && physicalKey == null) { throw UnsupportedError('Unsupported key: $key.'); } final Map arguments = { - 'keyCode': physicalKey?.keyCode, + 'keyCode': physicalKey?.usbHidUsage, 'modifiers': modifiers.map((e) => e.name).toList(), 'keyDown': keyDown, 'targetAppName': targetApp, @@ -87,3 +87,6 @@ class MethodChannelKeyPressSimulator extends KeyPressSimulatorPlatform { await methodChannel.invokeMethod('simulateMediaKey', arguments); } } + + + diff --git a/lib/bluetooth/devices/zwift/ftms_mdns_emulator.dart b/lib/bluetooth/devices/zwift/ftms_mdns_emulator.dart index 95c61493..f76fdd25 100644 --- a/lib/bluetooth/devices/zwift/ftms_mdns_emulator.dart +++ b/lib/bluetooth/devices/zwift/ftms_mdns_emulator.dart @@ -50,7 +50,7 @@ class FtmsMdnsEmulator extends TrainerConnection { } Future startServer() async { - return clickEmulator.startServer(core.settings.getTrainerApp() is Rouvy); + return clickEmulator.startServer(); } void stop() { @@ -119,3 +119,4 @@ class FtmsMdnsConstants { static const DC_MESSAGE_ENABLE_CHARACTERISTIC_NOTIFICATIONS = 0x05; // Enable Characteristic Notifications static const DC_MESSAGE_CHARACTERISTIC_NOTIFICATION = 0x06; // Characteristic Notification } + diff --git a/lib/bluetooth/devices/zwift/zwift_device.dart b/lib/bluetooth/devices/zwift/zwift_device.dart index c6f7bf72..0f12d2be 100644 --- a/lib/bluetooth/devices/zwift/zwift_device.dart +++ b/lib/bluetooth/devices/zwift/zwift_device.dart @@ -102,7 +102,7 @@ abstract class ZwiftDevice extends BluetoothDevice { } try { - if (bytes.startsWith(startCommand)) { + if (bytes.length >= startCommand.length && bytes.sublist(0, startCommand.length).toString() == startCommand.toString()) { processDevicePublicKeyResponse(bytes); } else { processData(bytes); @@ -221,3 +221,4 @@ abstract class ZwiftDevice extends BluetoothDevice { ); } } + diff --git a/lib/utils/keymap/apps/custom_app.dart b/lib/utils/keymap/apps/custom_app.dart index 13a5aa55..0a16e895 100644 --- a/lib/utils/keymap/apps/custom_app.dart +++ b/lib/utils/keymap/apps/custom_app.dart @@ -38,7 +38,7 @@ class CustomApp extends SupportedApp { return; } - final keyPairs = data.map((e) => KeyPair.decode(e)).whereNotNull().toList(); + final keyPairs = data.map((e) => KeyPair.decode(e)).whereType().toList(); if (keyPairs.isEmpty) { return; } @@ -83,3 +83,4 @@ class CustomApp extends SupportedApp { } } } + diff --git a/lib/utils/keymap/manager.dart b/lib/utils/keymap/manager.dart index 449f3797..39731e41 100644 --- a/lib/utils/keymap/manager.dart +++ b/lib/utils/keymap/manager.dart @@ -247,9 +247,7 @@ class KeymapManager { } else { final customApp = CustomApp(profileName: newName); - final connectedDeviceButtons = IterableFlatMap( - core.connection.controllerDevices, - ).flatMap((e) => e.availableButtons).toSet(); + final connectedDeviceButtons = core.connection.controllerDevices.expand((e) => e.availableButtons).toSet(); core.actionHandler.supportedApp!.keymap.keyPairs.forEachIndexed((pair, index) { pair.buttons.filter((button) => connectedDeviceButtons.contains(button) == true).forEachIndexed(( button, @@ -290,9 +288,7 @@ class KeymapManager { } else { final customApp = CustomApp(profileName: newName); - final connectedDeviceButtons = IterableFlatMap( - core.connection.controllerDevices, - ).flatMap((e) => e.availableButtons).toSet(); + final connectedDeviceButtons = core.connection.controllerDevices.expand((e) => e.availableButtons).toSet(); core.actionHandler.supportedApp!.keymap.keyPairs.forEachIndexed((pair, index) { pair.buttons.filter((button) => connectedDeviceButtons.contains(button) == true).forEachIndexed(( button, @@ -317,3 +313,4 @@ class KeymapManager { } } } +