BatteryBenchmark class

Benchmark session for measuring battery consumption.

Use this to compare battery usage between different configurations.

Example:

final benchmark = BatteryBenchmark();
await benchmark.start();

// ... run your tracking session ...

final result = await benchmark.finish();
print('Drain: ${result.drainPercent}% over ${result.duration.inMinutes} min');

Constructors

BatteryBenchmark()

Properties

hashCode int
The hash code for this object.
no setterinherited
isRunning bool
Whether the benchmark is running.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

finish({required int currentBattery}) BenchmarkResult
Finishes the benchmark and returns results.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recordGpsOff() → void
Records GPS being turned off.
recordGpsOn() → void
Records GPS being turned on.
recordLocationUpdate({double? accuracy}) → void
Records a location update.
recordStateChange(String newState) → void
Records a motion state change.
recordSync() → void
Records an HTTP sync request.
start({required int initialBattery}) → void
Starts the benchmark session.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited