device_manager 0.0.7 copy "device_manager: ^0.0.7" to clipboard
device_manager: ^0.0.7 copied to clipboard

Manager for hardware devices(USB, Serial. etc...) for Flutter Windows Desktop applications.

Device Manager for Flutter #

device_manager is a simple transmitter for the WM_DEVICECHANGE message. In other words, your Flutter Win32 App will be notified anytime there is a new hardware device connected to the computer.

Supported platforms:

  • Windows
  • Android

Usage #

To use this package, add device_manager as a dependency in your pubspec.yaml file.

Now go to lib\main.dart and add this code in the main function right after runApp(MyApp()); :

DeviceManager().addListener(() {
    var event = DeviceManager().lastEvent;
    if (event != null) {
        if (event.eventType == EventType.add) {
          scaffoldKey.currentState!.showSnackBar(
          const SnackBar(content: Text('New device detected!')));
        } else if (event.eventType == EventType.remove) {
          scaffoldKey.currentState!.showSnackBar(const SnackBar(content: Text('Device removed!')));
        }
    }
});

This listener will be called anytime a device had been connected or disconnected.

You can find examples in the example folder.

8
likes
140
points
802
downloads

Publisher

verified publisherfondleapp.com

Weekly Downloads

Manager for hardware devices(USB, Serial. etc...) for Flutter Windows Desktop applications.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on device_manager