powerman_win32 0.1.0 copy "powerman_win32: ^0.1.0" to clipboard
powerman_win32: ^0.1.0 copied to clipboard

PlatformWindows

A plugin to listen to Win32 power events such as AC power state, display on/off, and suspend/resume.

example/lib/main.dart

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

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    PowermanWin32.instance.getSystemPowerStatus();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Win32 Powerman Example'),
        ),
        body: Column(
          children: [
            StreamBuilder(
                stream: PowermanWin32.instance.systemPowerStatus,
                builder: (context, snapshot) => Text(snapshot.data?.toString() ?? '-')),
            StreamBuilder(
                stream: PowermanWin32.instance.suspendResume,
                builder: (context, snapshot) => Text(snapshot.data?.toString() ?? '-')),
            StreamBuilder(
                stream: PowermanWin32.instance.displayState,
                builder: (context, snapshot) => Text(snapshot.data?.toString() ?? '-')),
          ],
        ),
      ),
    );
  }
}
0
likes
120
pub points
16%
popularity

Publisher

verified publisherespresso3389.jp

A plugin to listen to Win32 power events such as AC power state, display on/off, and suspend/resume.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, plugin_platform_interface, rxdart

More

Packages that depend on powerman_win32