bluetooth_enable 0.0.3 copy "bluetooth_enable: ^0.0.3" to clipboard
bluetooth_enable: ^0.0.3 copied to clipboard

outdated

Flutter plugin to turn on bluetooth within app (Android only)

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:bluetooth_enable/bluetooth_enable.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
  }

  Future<void> test() async{
    BluetoothEnable.enableBluetooth.then((value){
      print(value);
    });    
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text(
            'Turn on Bluetooth',
          ),
          centerTitle: true,
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text("Press the button to request turning on Bluetooth"),
              SizedBox(height: 20.0),
              RaisedButton(
                onPressed: (() {
                  test();
                }),
                child: Text('Request to turn on Bluetooth'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
19
likes
0
pub points
75%
popularity

Publisher

unverified uploader

Flutter plugin to turn on bluetooth within app (Android only)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on bluetooth_enable