ClassicBluetoothManager class
High-level manager for Classic Bluetooth connections with automatic stream handling
This class provides a simplified interface for managing Bluetooth connections and data streaming with automatic cleanup and error handling.
Constructors
Properties
- connectedDevice → String?
-
Get connected device address
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConnected → bool
-
Get current connection status
no setter
- isListening → bool
-
Get listening status
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connectAndStartListening(
{required String deviceAddress, required void onData(ClassicDataEvent), void onConnectionChange(String error, String? deviceAddress)?, void onError(dynamic)?, bool autoStartStreaming = true, Duration connectionTimeout = const Duration(seconds: 30)}) → Future< void> - Connect to device and start listening to data and connection events
-
disconnect(
) → Future< void> - Disconnect and clean up all subscriptions
-
dispose(
) → Future< void> - Dispose and clean up all resources
-
getConnectionState(
) → Future< Map< String, dynamic> > - Get current connection state
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendData(
String data) → Future< Map< String, dynamic> > - Send data to connected device
-
startStreaming(
) → Future< void> - Start data streaming
-
stopStreaming(
) → Future< void> - Stop data streaming
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited