withAltitude method
- double altitude
Returns options with the camera at altitude meters above sea level.
The location and the orientation do not change.
Throws a StateError if FreeCameraOptions.position is null, because the altitude in mercator units depends on the latitude. Use withLocation to set both values.
Implementation
FreeCameraOptions withAltitude(double altitude) {
final position = this.position;
if (position == null) {
throw StateError('Set the camera location before the altitude.');
}
return copyWith(
position: position.copyWith(
z: altitude / _circumferenceAtLatitude(_latFromMercatorY(position.y)),
),
);
}