Bluebird class

Constructors

Bluebird()

Properties

hashCode int
The hash code for this object.
no setterinherited
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
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

adapterName Future<String>
Return the friendly Bluetooth name of the local Bluetooth adapter
no setter
adapterState AsyncValueStream<BluetoothAdapterState>
The state of the Bluetooth adapter, as a stream that also exposes the current value via await Bluebird.adapterState.value.
final
bondedDevices Future<List<BluetoothDevice>>
Retrieve a list of bonded devices (Android only)
no setter
connectedDevices List<BluetoothDevice>
Retrieve a list of devices currently connected to your app
no setter
events Stream<BluebirdEvent>
The raw stream of all app-level events, of every type.
no setter
isScanning ValueStream<bool>
whether a scan (via startScan or performScan) is currently running, as a stream that also exposes the current value:
no setter
isSupported Future<bool>
Checks whether the hardware supports Bluetooth
no setter
logger → Logger
The logger for every Bluebird log, yours to configure — attach a listener and set a level; nothing is printed unless you do:
no setter
platformLogLevel LogLevel
///////////////// The current platform log verbosity (see setPlatformLogLevel).
no setter
scanAdvertisements Stream<ScanResult>
Each advertisement of the scan started via startScan, one ScanResult at a time (broadcast; silent when no scan is running). scanResults is this, accumulated into a de-duplicated device list.
no setter
scanResults ValueStream<List<ScanResult>>
The growing, de-duplicated device list of the scan started via startScan, as a stream that also exposes the current value. Value-retaining: a late listener immediately sees the current devices. Reset to [] on each startScan; retained after stopScan until the next start.
no setter

Static Methods

adapterReady({Duration? timeout = const Duration(seconds: 60)}) Future<void>
Completes once the adapter is on; returns immediately if it already is.
configureLoggerPrinting({Level? level}) → void
Convenience for the common case: print logger records to the console (via debugPrint) in a default format, at level and above. For anything else — routing to a file or Crashlytics, a custom format, filtering by LogRecord.loggerName — listen to logger's onRecord yourself instead.
deviceForAddress(String address) BluetoothDevice
getPhySupport() Future<PhySupport>
Request Bluetooth PHY support
performScan({List<Uuid> withServices = const [], List<String> withRemoteIds = const [], List<String> withNames = const [], List<String> withKeywords = const [], List<MsdFilter> withMsd = const [], List<ServiceDataFilter> withServiceData = const [], bool continuousUpdates = false, int continuousDivisor = 1, bool androidLegacy = false, AndroidScanMode androidScanMode = AndroidScanMode.lowLatency, bool androidUsesFineLocation = false, List<Uuid> webOptionalServices = const [], Duration? timeout}) Stream<ScanResult>
Scan for Bluetooth Low Energy devices, as a stream of advertisements — the all-in-one form (no separate stop). For the stateful start/stop/results model, use startScan / stopScan / scanResults instead.
resetForTest() → void
Resets all global state and re-subscribes to the current platform on the next call. For tests only.
setOptions({bool showPowerAlert = true, bool restoreState = false}) Future<void>
Set configurable options
setPlatformLogLevel(LogLevel level) Future<void>
Sets the verbosity of the native platform logging (Android logcat / Apple os_log). Those logs surface through the platform's own tooling (logcat / Console.app), not through logger.
startScan({List<Uuid> withServices = const [], List<String> withRemoteIds = const [], List<String> withNames = const [], List<String> withKeywords = const [], List<MsdFilter> withMsd = const [], List<ServiceDataFilter> withServiceData = const [], bool continuousUpdates = false, int continuousDivisor = 1, bool androidLegacy = false, AndroidScanMode androidScanMode = AndroidScanMode.lowLatency, bool androidUsesFineLocation = false, List<Uuid> webOptionalServices = const [], Duration? timeout}) Future<void>
Starts a scan and accumulates its de-duplicated devices into scanResults (value-retaining — read .value or listen). Each raw advertisement is also available one at a time via scanAdvertisements. Stop it with stopScan; isScanning tracks whether it is running. Only one scan may run at a time (the radio is a single resource); startScan throws BluebirdErrorCode.operationInProgress if one already is.
stopScan() Future<void>
Stops a scan started via startScan. Idempotent.
systemDevices(List<Uuid> withServices) Future<List<BluetoothDevice>>
Retrieve a list of devices currently connected to the system
turnOn({Duration timeout = const Duration(seconds: 60)}) Future<void>
Turn on Bluetooth (Android only)