flutter_blue_plus_windows

Last updated:

0 purchases

flutter_blue_plus_windows Image
flutter_blue_plus_windows Images
Add to Cart

Description:

flutter blue plus windows

Flutter Blue Plus Windows #
This project is a wrapper library for Flutter Blue Plus and Win_ble.
It allows Flutter_blue_plus to operate on Windows.
With minimal effort, you can use Flutter Blue Plus on Windows.
Usage #
Only you need to do is change the import statement.
// instead of import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_blue_plus_windows/flutter_blue_plus_windows.dart';

// Alternatively, you can hide FlutterBluePlus when importing the FBP statement
import 'package:flutter_blue_plus/flutter_blue_plus.dart' hide FlutterBluePlus;
import 'package:flutter_blue_plus_windows/flutter_blue_plus_windows.dart';

copied to clipboard
Scan devices #
final scannedDevices = <ScanResult>{};

const timeout = Duration(seconds: 3);
FlutterBluePlus.startScan(timeout: timeout);

final sub = FlutterBluePlus.scanResults.expand((e)=>e).listen(scannedDevices.add);

await Future.delayed(timeout);
sub.cancel();
scannedDevices.forEach(print);
copied to clipboard
Connect a device #
final scannedDevice = scannedDevices
.where((scanResult) => scanResult.device.platformName == DEVICE_NAME)
.firstOrNull;
final device = scannedDevice?.device;
device?.connect();
copied to clipboard
Disconnect the device #
device?.disconnect();
copied to clipboard
Check out the usage of Flutter Blue Plus on Flutter Blue Plus

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.