powerState abstract method

Future<PowerState> powerState({
  1. Map<String, dynamic>? extra,
})

Returns whether or not the motor is currently powered, and the portion of max power (between 0 and 1; 0 indicates that power is off). Stepper motors report true if they are being powered while holding a position, as well as when they are turning themselves.

// Check whether the motor is currently powered and
// check the percentage of max power to the motor.
var powerState = await myMotor.powerState();
var powered = powerState.isOn;
var pct = powerState.powerPct;

For more information, see Motor component.

Implementation

Future<PowerState> powerState({Map<String, dynamic>? extra});