getPosition method

  1. @override
Future<int> getPosition({
  1. Map<String, dynamic>? extra,
})
override

Get the current position (int) of the Switch.

var position = await mySwitch.getPosition();

For more information, see Switch component.

Implementation

@override
Future<int> getPosition({Map<String, dynamic>? extra}) async {
  final request = GetPositionRequest()
    ..name = name
    ..extra = extra?.toStruct() ?? Struct();
  final response = await client.getPosition(request);
  return response.position;
}