{"id":13785199,"url":"https://github.com/rohitsangwan01/win_ble","last_synced_at":"2025-10-25T05:09:02.709Z","repository":{"id":38188704,"uuid":"486672032","full_name":"rohitsangwan01/win_ble","owner":"rohitsangwan01","description":"WinBle Plugin to use Bluetooth Low Energy in Flutter Windows Desktop","archived":false,"fork":false,"pushed_at":"2024-07-08T15:38:07.000Z","size":10056,"stargazers_count":37,"open_issues_count":16,"forks_count":15,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T20:53:22.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rohitsangwan01.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-28T16:35:31.000Z","updated_at":"2025-03-28T10:33:43.000Z","dependencies_parsed_at":"2023-12-13T11:22:52.901Z","dependency_job_id":"965b7598-1d55-456f-9f9c-6acb60fa7503","html_url":"https://github.com/rohitsangwan01/win_ble","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":0.5,"last_synced_commit":"678cc8a8a39b4eae82a435dfde3e8e2c2c0a5b5d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohitsangwan01%2Fwin_ble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohitsangwan01%2Fwin_ble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohitsangwan01%2Fwin_ble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohitsangwan01%2Fwin_ble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohitsangwan01","download_url":"https://codeload.github.com/rohitsangwan01/win_ble/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111976,"owners_count":21049577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T19:00:58.030Z","updated_at":"2025-10-25T05:09:02.632Z","avatar_url":"https://github.com/rohitsangwan01.png","language":"C++","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# WinBle\n\n[![win_ble version](https://img.shields.io/pub/v/win_ble?label=win_ble)](https://pub.dev/packages/win_ble)\n\nUse the WinBle plugin to enable Bluetooth Low Energy in Flutter Windows and pure Dart projects (Windows only)\n\n## Usage\n\nFirst initialize WinBle, to initialize on Flutter Windows, get server path using `await WinServer.path`, and for pure dart projects ( Windows only ) Download [BleServer.exe](https://github.com/rohitsangwan01/win_ble/blob/main/lib/assets/BLEServer.exe) file and place in the same folder, checkout `example_dart` for more details\n\n```dart\n  // To initialize on Flutter Windows\n  await WinBle.initialize(serverPath: await WinServer.path());\n\n  // For pure dart projects\n  await WinBle.initialize(serverPath: \"Path of BLEServer.exe file\");\n```\n\nDispose WinBle after using\n\n```dart\n WinBle.dispose();\n```\n\nTo Start Scan\n\n```dart\n WinBle.startScanning();\n\n StreamSubscription? scanStream = WinBle.scanStream.listen((event) {\n  // Get Devices Here\n });\n```\n\nTo Stop Scan\n\n```dart\n  WinBle.stopScanning();\n\n  scanStream?.cancel();\n```\n\nTo Connect\n\n```dart\n // To Connect\n await WinBle.connect(address);\n\n // Get Connection Updates Here\n StreamSubscription  _connectionStream =\n    WinBle.connectionStreamOf(device.address).listen((event) {\n    // event will be a boolean , in which\n    // true =\u003e Connected\n    // false =\u003e Disconnected\n });\n```\n\nTo Disconnect\n\n```dart\n  await WinBle.disconnect(address);\n```\n\nTo get MaxMtuSize\n\n```dart\n  await WinBle.getMaxMtuSize(address);\n```\n\nHandle Bluetooth radio\n\n```dart\n  // To get rdaio status\n  WinBle.getBluetoothState();\n\n  // To get updates of radio state\n  WinBle.bleState.listen((BleState state) {\n    // Get BleState (On, Off, Unknown, Disabled, Unsupported)\n  });\n\n  // To turn on radio\n  WinBle.updateBluetoothState(true);\n\n  // To turn off radio\n  WinBle.updateBluetoothState(false);\n```\n\nPairing Options\n\n```dart\n  // To Pair\n  await WinBle.pair(address);\n\n  // To UnPair\n  await WinBle.unPair(address);\n\n  // To Check if Device can be Paired\n  bool canPair = await WinBle.canPair(address);\n\n  // To Check if Device is Already Paired\n  bool isPaired = await WinBle.isPaired(address);\n```\n\nRest All Methods are\n\n```dart\n  // To Get Services\n  var services = await WinBle.discoverServices(address);\n\n  // To Get Characteristic\n  List\u003cBleCharacteristic\u003e bleCharacteristics = await WinBle.discoverCharacteristics(address: address, serviceId: serviceID);\n\n  // To Read Characteristic\n  List\u003cint\u003e data = await WinBle.read(address: address, serviceId: serviceID, characteristicId: charID);\n\n  // To Write Characteristic\n  await WinBle.write( address: address, service: serviceID,  characteristic: charID,  data: data, writeWithResponse: writeWithResponse);\n\n  // To Start Subscription\n  await WinBle.subscribeToCharacteristic(address: address, serviceId: serviceID, characteristicId: charID);\n\n  // To Stop Subscription\n  await WinBle.unSubscribeFromCharacteristic(address: address, serviceId: serviceID, characteristicId: charID);\n\n  // Get Characteristic Value Updates Here\n   StreamSubscription _characteristicValueStream = WinBle.characteristicValueStream.listen((event) {\n     // Here We will Receive All Characteristic Events\n   });\n\n```\n\n## Note\n\nRequires Windows version \u003e= 10.0.15014\n\n\u003cdetails\u003e\n  \u003csummary\u003eIf windows release build opens cmd while running app, try this\u003c/summary\u003e\n  \nEdit your `/windows/runner/main.cpp` file, this is a known flutter [issue](https://github.com/flutter/flutter/issues/47891)\n\n```c++\nif (!::AttachConsole(ATTACH_PARENT_PROCESS) \u0026\u0026 ::IsDebuggerPresent()){\nCreateAndAttachConsole();\n}\n// Add this Code\n// \u003c------- From Here --------- \u003e\nelse{\n    STARTUPINFO si = {0};\n    si.cb = sizeof(si);\n    si.dwFlags = STARTF_USESHOWWINDOW;\n    si.wShowWindow = SW_HIDE;\n\n    PROCESS_INFORMATION pi = {0};\n    WCHAR lpszCmd[MAX_PATH] = L\"cmd.exe\";\n    if (::CreateProcess(NULL, lpszCmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE | CREATE_NO_WINDOW, NULL, NULL, \u0026si, \u0026pi))\n    {\n      do\n      {\n        if (::AttachConsole(pi.dwProcessId))\n        {\n          ::TerminateProcess(pi.hProcess, 0);\n          break;\n        }\n      } while (ERROR_INVALID_HANDLE == GetLastError());\n      ::CloseHandle(pi.hProcess);\n      ::CloseHandle(pi.hThread);\n    }\n}\n// \u003c------- UpTo Here --------- \u003e\n```\n\n\u003c/details\u003e\n\n## Additional information\n\nThanks to [noble-winrt](https://github.com/urish/noble-winrt) for initial BleServer Code\n\nThis is Just The Initial Version feel free to Contribute or Report any Bug!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohitsangwan01%2Fwin_ble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohitsangwan01%2Fwin_ble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohitsangwan01%2Fwin_ble/lists"}