bluetooth_state 0.0.1 copy "bluetooth_state: ^0.0.1" to clipboard
bluetooth_state: ^0.0.1 copied to clipboard

A Plugin Flutter Bluetooth turn off/on

bluetooth_state #

A Plugin Flutter Bluetooth turn off/on

Getting Started #

Install #

Add the following lines in your pubspec.yaml file

  bluetooth_state: ^latest_version

API #

Is Bluetooth Enable

Future<bool> get isBluetoothEnable async {
  try {
    return await BluetoothState().isBluetoothEnable;
  } catch (e) {
    print(e);
    throw 'Failed to get is bluetooth enable';
  }
}

Request Enable Bluetooth

Future<void> requestEnableBluetooth() async {
  try {
    await BluetoothState.requestEnableBluetooth();
  } catch (e) {
    print(e);
    throw 'Failed to request enable bluetooth';
  }
}

Request Disable Bluetooth

Future<void> requestDisableBluetooth() async {
  try {
    await BluetoothState.requestDisableBluetooth();
  } catch (e) {
    print(e);
    throw 'Failed to request disable bluetooth';
  }
}
1
likes
140
points
71
downloads

Publisher

unverified uploader

Weekly Downloads

A Plugin Flutter Bluetooth turn off/on

Repository (GitHub)

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on bluetooth_state