position method

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

Get the current GeoPoint (latitude, longitude) and altitude (mm).

var position = await myMovementSensor.position();
var altitude = position.altitude;
var coordinates = position.coordinates;

For more information, see Movement Sensor component.

Implementation

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