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

PlatformAndroid

A Flutter plugin to check if USB debugging is enabled on Android.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('USB Debugging Checker Example'),
          bottom: const PreferredSize(
            preferredSize: Size(double.infinity, 1),
            child: Divider(
              height: 1,
              thickness: 1,
            ),
          ),
        ),
        body: Center(
          child: FutureBuilder<bool>(
            future: UsbDebugChecker.isUsbDebuggingEnabled(),
            builder: (context, snapshot) {
              if (snapshot.connectionState == ConnectionState.waiting) {
                return const CircularProgressIndicator();
              } else if (snapshot.hasError) {
                return Text('Error: ${snapshot.error}');
              } else {
                return RichText(
                  text: TextSpan(
                    children: [
                      const TextSpan(
                        text: 'USB Debugging is ',
                        style: TextStyle(
                          fontWeight: FontWeight.normal,
                          fontSize: 20,
                          color: Colors.black, // Set the text color
                        ),
                      ),
                      TextSpan(
                        text: snapshot.data == true ? 'Enabled' : 'Disabled',
                        style: const TextStyle(
                          fontWeight: FontWeight.bold,
                          fontSize: 23,
                          color: Colors.red, // Set the text color
                        ),
                      ),
                    ],
                  ),
                );
              }
            },
          ),
        ),
      ),
    );
  }
}
3
likes
140
points
8
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin to check if USB debugging is enabled on Android.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on usb_debug_checker

Packages that implement usb_debug_checker