dispose static method

Future<void> dispose()

Disposes of the SDK resources, stopping any active processes.

This method should be called when the SDK is no longer needed to clean up resources such as BLE connections and discovery.

After calling this method, the SDK will need to be initialized again.

Implementation

static Future<void> dispose() async {
  try {
    _ensureInitialized(); // Check if SDK is initialized before disposing
    await _bluetoothManager.dispose();
    _isInitialized = false;
  } catch (e) {
    _appLogger.error("Error disposing OptiConnect: $e");
    rethrow;
  }
}