thermal 1.1.11 copy "thermal: ^1.1.11" to clipboard
thermal: ^1.1.11 copied to clipboard

Flutter plugin for accessing the device's thermal state to detect if the device is undergoing thermal throttling.

example/lib/main.dart

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

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

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Thermal example app'),
        ),
        body: Center(
          child: Column(children: [
            FutureBuilder<ThermalStatus>(
                future: Thermal().thermalStatus,
                builder: (context, snapshot) {
                  return Text("Thermal status: ${snapshot.data}");
                }),
            StreamBuilder<ThermalStatus>(
                stream: Thermal().onThermalStatusChanged,
                builder: (context, snapshot) {
                  return Text("Live thermal status: ${snapshot.data}");
                }),
            StreamBuilder<double>(
                stream: Thermal().onBatteryTemperatureChanged,
                builder: (context, snapshot) {
                  return Text("Battery temperature: ${snapshot.data}°C");
                })
          ]),
        ),
      ),
    );
  }
}
12
likes
160
points
4.14k
downloads

Publisher

verified publishermuxable.com

Weekly Downloads

Flutter plugin for accessing the device's thermal state to detect if the device is undergoing thermal throttling.

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on thermal