BluetoothWriteException class

BluetoothWriteException is a custom exception type that indicates an error occurred during the process of writing values to a Bluetooth Low Energy (BLE) characteristic. It is thrown when the BLE operation to write data to a characteristic fails due to various reasons such as Bluetooth connection issues, the characteristic not being writable, or the device not being properly connected or paired.

This exception provides a mechanism to handle write failures gracefully in the application logic, allowing developers to provide feedback to the user or to attempt recovery actions. The message field typically includes a detailed description of the error, possibly containing error codes or additional information provided by the BLE stack or the underlying platform.

Example

try {
  // Attempt to write to a BLE characteristic
} on BluetoothWriteException catch (e) {
  // Handle the exception by informing the user or attempting a retry
  print(e);
}
Implemented types

Constructors

BluetoothWriteException(String message)
Creates a BluetoothWriteException 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 write operation.
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