optimization_battery 0.0.4 copy "optimization_battery: ^0.0.4" to clipboard
optimization_battery: ^0.0.4 copied to clipboard

outdated

check battery optimization and open battery_optimization setting

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: BatteryOptimizationsObserver(builder: (context, isIgonre) {
          return Column(
            children: [
              Text('isIgonred : $isIgonre'),
              if (isIgonre != null && !isIgonre)
                ElevatedButton(
                    onPressed: () {
                      OptimizationBattery.openBatteryOptimizationSettings();
                    },
                    child: const Text("open igonre battery setting"))
            ],
          );
        }),
      ),
    );
  }
}
8
likes
0
points
194
downloads

Publisher

unverified uploader

Weekly Downloads

check battery optimization and open battery_optimization setting

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on optimization_battery