thermal 1.1.5 copy "thermal: ^1.1.5" to clipboard
thermal: ^1.1.5 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
pub points
70%
popularity

Publisher

verified publishermuxable.com

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on thermal