thermal 1.2.0 copy "thermal: ^1.2.0" to clipboard
thermal: ^1.2.0 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
145
points
10.2k
downloads

Documentation

API reference

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)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on thermal

Packages that implement thermal