Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/src/extension/bluetooth_characteristic_extension.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter_blue_plus_platform_interface/flutter_blue_plus_platform_interface.dart';
import 'package:flutter_blue_plus_windows/flutter_blue_plus_windows.dart';

extension BluetoothCharacteristicExtension on BluetoothCharacteristic {
Expand All @@ -8,7 +9,8 @@ extension BluetoothCharacteristicExtension on BluetoothCharacteristic {
characteristicUuid: characteristicUuid,
descriptors: [for (final d in descriptors) d.toProto()],
properties: properties.toProto(),
primaryServiceUuid: null, // TODO: API changes
primaryServiceUuid: null,
instanceId: 0, // TODO: API changes
);
}
}
4 changes: 3 additions & 1 deletion lib/src/extension/bluetooth_descriptor_extension.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_blue_plus_platform_interface/flutter_blue_plus_platform_interface.dart';

extension BluetoothDescriptorExtension on BluetoothDescriptor {
BmBluetoothDescriptor toProto() {
Expand All @@ -7,7 +8,8 @@ extension BluetoothDescriptorExtension on BluetoothDescriptor {
serviceUuid: serviceUuid,
characteristicUuid: characteristicUuid,
descriptorUuid: descriptorUuid,
primaryServiceUuid: null, // TODO: API changes
primaryServiceUuid: null,
instanceId: 0, // TODO: API changes
);
}
}
1 change: 1 addition & 0 deletions lib/src/extension/bluetooth_service_extension.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter_blue_plus_platform_interface/flutter_blue_plus_platform_interface.dart';
import 'package:flutter_blue_plus_windows/flutter_blue_plus_windows.dart';

extension BluetoothServiceExtension on BluetoothService {
Expand Down
1 change: 1 addition & 0 deletions lib/src/extension/characteristic_properties_extension.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_blue_plus_platform_interface/flutter_blue_plus_platform_interface.dart';

extension CharacteristicPropertiesExtension on CharacteristicProperties {
BmCharacteristicProperties toProto() {
Expand Down
6 changes: 4 additions & 2 deletions lib/src/windows/bluetooth_characteristic_windows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class BluetoothCharacteristicWindows extends BluetoothCharacteristic {
serviceUuid: descriptor.serviceUuid,
characteristicUuid: descriptor.characteristicUuid,
descriptorUuid: descriptor.uuid,
primaryServiceUuid: null, // TODO: API changes
primaryServiceUuid: null,
instanceId: 0, // TODO: API changes
),
],
properties: BmCharacteristicProperties(
Expand All @@ -46,7 +47,8 @@ class BluetoothCharacteristicWindows extends BluetoothCharacteristic {
// TODO: implementation missing
indicateEncryptionRequired: false,
),
primaryServiceUuid: null, // TODO: API changes
primaryServiceUuid: null,
instanceId: 0, // TODO: API changes
),
);

Expand Down
1 change: 1 addition & 0 deletions lib/src/windows/bluetooth_device_windows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class BluetoothDeviceWindows extends FBP.BluetoothDevice {

Future<void> createBond({
int timeout = 90, // TODO: implementation missing
Uint8List? pin,
}) async {
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pin parameter is added to match the API signature but is not used in the implementation. If WinBle.pair() doesn't support PIN-based pairing, this should be documented with a TODO comment or the parameter should be used if the underlying API supports it.

Suggested change
}) async {
}) async {
// TODO: The 'pin' parameter is currently unused because WinBle.pair() does not support PIN-based pairing.
// If WinBle adds support for PIN-based pairing in the future, update this method to use the 'pin' parameter.

Copilot uses AI. Check for mistakes.
try {
await WinBle.pair(_address);
Expand Down
9 changes: 9 additions & 0 deletions lib/src/windows/flutter_blue_plus_windows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ class FlutterBluePlusWindows {
// TODO: compare with original lib
static Stream<List<ScanResult>> get scanResults => _scanResultsList.stream;

static Stream<List<ScanResult>> get onScanResults {
if (isScanningNow) {
return _scanResultsList.stream;
} else {
// skip previous results & push empty list
return _scanResultsList.stream.skip(1).newStreamWithInitialValue([]);
}
}

static Stream<BluetoothAdapterState> get adapterState async* {
await _initialize();
yield _state;
Expand Down
1 change: 1 addition & 0 deletions lib/src/windows/windows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:developer';
import 'dart:io';
import 'dart:typed_data';

import 'package:flutter_blue_plus_platform_interface/flutter_blue_plus_platform_interface.dart';
import 'package:flutter_blue_plus_windows/flutter_blue_plus_windows.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart' as FBP;

Expand Down
5 changes: 5 additions & 0 deletions lib/src/wrapper/flutter_blue_plus_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ class FlutterBluePlus {
return FBP.FlutterBluePlus.scanResults;
}

static Stream<List<ScanResult>> get onScanResults {
if (Platform.isWindows) return FlutterBluePlusWindows.onScanResults;
return FBP.FlutterBluePlus.onScanResults;
}

static bool get isScanningNow {
if (Platform.isWindows) return FlutterBluePlusWindows.isScanningNow;
return FBP.FlutterBluePlus.isScanningNow;
Expand Down
7 changes: 6 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ environment:
sdk: ">=3.0.0 <4.0.0"

dependencies:
flutter_blue_plus: ">=1.32.4 <1.35.0"
# https://pub.dev/packages/flutter_blue_plus
flutter_blue_plus: ^1.36.8
# https://pub.dev/packages/flutter_blue_plus_platform_interface
flutter_blue_plus_platform_interface: 7.0.0
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version constraint for flutter_blue_plus_platform_interface should use a caret (^) prefix or range constraint for consistency with other dependencies and to allow compatible updates. Using an exact version (7.0.0) may cause dependency resolution issues when other packages require different patch versions of the same major version.

Suggestion: Change to ^7.0.0 or ">=7.0.0 <8.0.0"

Suggested change
flutter_blue_plus_platform_interface: 7.0.0
flutter_blue_plus_platform_interface: ^7.0.0

Copilot uses AI. Check for mistakes.
# https://pub.dev/packages/win_ble
win_ble: ">=1.1.1"
# https://pub.dev/packages/stream_with_value
stream_with_value: ">=0.5.0"