collect method

  1. @override
Future<num> collect()

Implementation

@override
Future<num> collect() async {
  ensureOsSupported();

  final info = await BatteryInfoPlugin().androidBatteryInfo;
  final temperature = info?.temperature ?? kUnknownBatteryTemperature;
  _data[DateTime.now().toUtc()] = temperature;

  return temperature;
}