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

`device_util_plus` is a lightweight Flutter package that provides easy access to device information like battery, network and storage.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:device_util_plus/device_util_plus.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();

    BatteryUtils.getBatteryLevel().then((result) {
      print('_MyAppState.initState : getBatteryLevel : => $result');
    });

    BatteryUtils.onBatteryLevelChanged.listen((level) {
      print('_MyAppState.initState:onBatteryLevelChanged => $level');
    });

    BatteryUtils.onBatteryStateChanged.listen((status) {
      print('_MyAppState.initState:onBatteryStateChanged => $status');
    });

    NetworkUtils.isConnected().then((result) {
      print('_MyAppState.initState : isConnected : => $result');
    });

    NetworkUtils.onNetworkChange.listen((result) {
      print('_MyAppState.initState : onNetworkChange : => $result');
    });

    StorageUtils.info().then((data) {
      print('StorageUtils => ${data.toString()}');
    });

    DeviceUtils.info().then((data) {
      print('DeviceUtils => ${data.toString()}');
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Plugin example app')),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              DeviceUtils.vibrate();
            },
            child: Text("Test Vibrate"),
          ),
        ),
      ),
    );
  }
}
1
likes
160
points
18
downloads

Publisher

unverified uploader

Weekly Downloads

`device_util_plus` is a lightweight Flutter package that provides easy access to device information like battery, network and storage.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on device_util_plus

Packages that implement device_util_plus