overriddenLocation property

Position? overriddenLocation

Returns the overridden location. If the location has not been overridden then this will return null.

Implementation

Position? get overriddenLocation => _overriddenLocation;
void overriddenLocation=(Position? location)

Sets the overridden location. Set to null to reset back to using the value from the device.

Implementation

set overriddenLocation(Position? location) {
  if (_testController == null && location != null) {
    throw Exception(
      'The location may not be overridden unless the plugin was initialized with a TestController.',
    );
  }
  _overriddenLocation = location;

  if (_overriddenLocation == null) {
    _overriddenLocationPermission = null;
  } else {
    _overriddenLocationPermission ??= LocationPermission.whileInUse;

    _locationStreamController?.add(_overriddenLocation!);
  }

  refresh();
}