Package selection guidance compiled from public package information, community data, and project usage.
The win_ble package enables Bluetooth Low Energy (BLE) functionality in Flutter applications targeting Windows and pure Dart projects. Designed specifically for Windows, it provides a bridge to native BLE capabilities, allowing developers to discover devices, connect to peripherals, read and write characteristics, and manage BLE operations. This plugin is ideal for applications requiring low-power wireless communication with BLE devices on Windows platforms. It leverages the Windows Bluetooth API through platform channels, ensuring reliable performance within the Flutter ecosystem.
Use cases
Connecting to BLE sensors
Reading data from BLE beacons
Controlling BLE-enabled IoT devices
Developing Windows-only health monitoring apps
Implementing proximity-based features
Key features
Windows-only BLE support
Native Windows Bluetooth API integration
Device discovery and connection management
Characteristic read/write operations
Pure Dart compatibility
Suitable for
Windows desktop app developers
IoT device integrators
Health and fitness app creators
Bluetooth-centric utility tools
Cross-platform apps with Windows-specific BLE needs
Considerations
Limited to Windows platform
Requires Windows 10 or later
No support for Android/iOS
Depends on system-level Bluetooth permissions
May require additional configuration for certain hardware
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
WinBle
Use the WinBle plugin to enable Bluetooth Low Energy in Flutter Windows and pure Dart projects (Windows only)
Usage
First initialize WinBle, to initialize on Flutter Windows, get server path using await WinServer.path, and for pure dart projects ( Windows only ) Download BleServer.exe file and place in the same folder, checkout example_dart for more details
// To initialize on Flutter WindowsawaitWinBle.initialize(serverPath: awaitWinServer.path());
// For pure dart projectsawaitWinBle.initialize(serverPath: "Path of BLEServer.exe file");
Dispose WinBle after using
WinBle.dispose();
To Start Scan
WinBle.startScanning();
StreamSubscription? scanStream = WinBle.scanStream.listen((event) {
// Get Devices Here
});
To Stop Scan
WinBle.stopScanning();
scanStream?.cancel();
To Connect
// To ConnectawaitWinBle.connect(address);
// Get Connection Updates HereStreamSubscription _connectionStream =
WinBle.connectionStreamOf(device.address).listen((event) {
// event will be a boolean , in which// true => Connected// false => Disconnected
});
To Disconnect
awaitWinBle.disconnect(address);
To get MaxMtuSize
awaitWinBle.getMaxMtuSize(address);
Handle Bluetooth radio
// To get rdaio statusWinBle.getBluetoothState();
// To get updates of radio stateWinBle.bleState.listen((BleState state) {
// Get BleState (On, Off, Unknown, Disabled, Unsupported)
});
// To turn on radioWinBle.updateBluetoothState(true);
// To turn off radioWinBle.updateBluetoothState(false);
Pairing Options
// To PairawaitWinBle.pair(address);
// To UnPairawaitWinBle.unPair(address);
// To Check if Device can be Pairedbool canPair = awaitWinBle.canPair(address);
// To Check if Device is Already Pairedbool isPaired = awaitWinBle.isPaired(address);
Rest All Methods are
// To Get Servicesvar services = awaitWinBle.discoverServices(address);
// To Get CharacteristicList<BleCharacteristic> bleCharacteristics = awaitWinBle.discoverCharacteristics(address: address, serviceId: serviceID);
// To Read CharacteristicList<int> data = awaitWinBle.read(address: address, serviceId: serviceID, characteristicId: charID);
// To Write CharacteristicawaitWinBle.write( address: address, service: serviceID, characteristic: charID, data: data, writeWithResponse: writeWithResponse);
// To Start SubscriptionawaitWinBle.subscribeToCharacteristic(address: address, serviceId: serviceID, characteristicId: charID);
// To Stop SubscriptionawaitWinBle.unSubscribeFromCharacteristic(address: address, serviceId: serviceID, characteristicId: charID);
// Get Characteristic Value Updates HereStreamSubscription _characteristicValueStream = WinBle.characteristicValueStream.listen((event) {
// Here We will Receive All Characteristic Events
});
Note
Requires Windows version >= 10.0.15014
If windows release build opens cmd while running app, try this
Edit your /windows/runner/main.cpp file, this is a known flutter issue
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()){
CreateAndAttachConsole();
}
// Add this Code// <------- From Here --------- >else{
STARTUPINFO si = {0};
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi = {0};
WCHAR lpszCmd[MAX_PATH] = L"cmd.exe";
if (::CreateProcess(NULL, lpszCmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
{
do
{
if (::AttachConsole(pi.dwProcessId))
{
::TerminateProcess(pi.hProcess, 0);
break;
}
} while (ERROR_INVALID_HANDLE == GetLastError());
::CloseHandle(pi.hProcess);
::CloseHandle(pi.hThread);
}
}
// <------- UpTo Here --------- >