FlutterWebBluetooth class

The main class to request devices from on the web.

Just get an instance using instance and request a device using requestDevice.

Note: this is the unsupported variant that is exposed in io builds, check the web version where the functions actually work!

Inheritance

Properties

advertisements Stream<AdvertisementReceivedEvent<AdvertisementBluetoothDevice>>
the advertisements stream emits AdvertisementReceivedEvents for devices found through requestLEScan.
no setteroverride
defaultAdvertisementsMemory bool
This is a setting for (new) devices if it should use memory for advertisements.
getter/setter pairinherited
devices Stream<Set<BluetoothDevice>>
Get a Stream with a Set of all devices paired in this browser session. If the browser supports Bluetooth.getDevices, which none currently do unless a flag is used, then it will also return a list of all paired devices.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
hasRequestLEScan bool
Check to see if the current browser has the requestLEScan method.
final
isAvailable Stream<bool>
Get a Stream for the availability of a Bluetooth adapter.
no setteroverride
isBluetoothApiSupported bool
Get if the bluetooth api is available in this browser. This will only check if the api is in the navigator. Not if anything is available. This will return false if the website is not loaded in a secure context.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestAdvertisementDevice(AdvertisementBluetoothDevice device, {List<String> requiredServices = const [], List<String> optionalServices = const []}) → Never
The advertisements stream emits an event with a AdvertisementBluetoothDevice. This device doesn't have a gatt server and can thus not do everything you may want.
override
requestDevice(RequestOptionsBuilder options) → Never
Request a WebBluetoothDevice from the browser (user). This will resolve into a single device even if the filter options (and environment) have multiple devices that fit that could be found.
override
requestLEScan(LEScanOptionsBuilder options) → Never
Request the user to start scanning for Bluetooth LE devices in the area. Not every browser supports this method yet so check it using hasRequestLEScan. However even if the browser supports it, the Future may never complete on browsers. This has been the case for Chrome on linux and windows even with the correct flag enabled. Chrome on Android does seem to work. Add a Future.timeout to combat this.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance FlutterWebBluetoothInterface
Get an instance of the library. There will always only be one instance.
no setter