BluetoothConnectionException class

Exception for handling errors during the BLE peripheral connection process.

This exception is thrown when an attempt to connect to a Bluetooth Low Energy (BLE) peripheral fails or encounters a problem. Establishing a connection is the first step in BLE communication, which enables further interactions such as service discovery, reading, and writing characteristic values.

The BluetoothConnectionException carries a message that provides more information about the failure, which can be valuable for troubleshooting or informing the user about what went wrong.

Example

Here's how to handle a BluetoothConnectionException:

try {
  // Attempt to connect to a BLE peripheral
} on BluetoothConnectionException catch (e) {
  // Respond to the connection error, perhaps by notifying the user or attempting a reconnect
  print(e.message);
}
Implemented types

Constructors

BluetoothConnectionException.new(String message)
Creates a BluetoothConnectionException with the specified error message.

Properties

hashCode int
The hash code for this object.
no setterinherited
message String
A message describing the error that occurred during the connection process.
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
toString() String
A string representation of this object.
override

Operators

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