startFollowingPosition method
- GemAnimation? animation,
- int zoomLevel = -1,
- double? viewAngle,
- MapSceneObject? positionObj,
Activates follow position mode to track the current location.
Enables automatic camera tracking of the device's real or simulated position. The map continuously updates to keep the current position visible, with optional animation to the starting position. This mode disables the cursor if enabled and requires automatic map rendering.
Uses the positions provided by the PositionService. Ensure that the position service is started and providing updates before activating follow mode or start simulation on a route via the NavigationService.
Use the stopFollowingPosition method to exit follow mode and configure options with FollowPositionPreferences if needed. See MapSceneObject.getDefPositionTracker for customizing the navigation arrow appearance.
Parameters
animation: Animation settings for transitioning to follow mode. Ifnull, starts instantly. Defaults tonullzoomLevel: Target zoom level when follow mode starts. Use-1for automatic selection. Defaults to-1viewAngle: Camera pitch angle in degrees (0-90), where 0 is top-down view and 90 is horizon view. Ifnull, uses default angle. Defaults tonullpositionObj: Custom MapSceneObject for the navigation arrow. Ifnull, uses the SDK's default arrow. Defaults tonull
See also:
- stopFollowingPosition - Deactivate follow position mode
- isFollowingPosition - Check if follow mode is active
- restoreFollowingPosition - Restore to default auto-zoom follow mode
Implementation
void startFollowingPosition({
final GemAnimation? animation,
final int zoomLevel = -1,
final double? viewAngle,
final MapSceneObject? positionObj,
}) {
final bool hasViewAngle = viewAngle != null;
objectMethod(
_pointerId,
'MapView',
'startFollowingPosition',
args: <String, Object>{
if (animation != null) 'animation': animation,
'zoomLevel': zoomLevel,
'viewAngle': hasViewAngle ? viewAngle : -1,
if (positionObj != null) 'positionObj': positionObj,
},
);
}