flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

[Bug]: Fake Location problem when calling getCurrentPosition and getLastKnownPosition

Open shehabmohamed0 opened this issue 4 months ago • 0 comments

Please check the following before submitting a new issue.

Please select affected platform(s)

  • [x] Android
  • [ ] iOS
  • [ ] Linux
  • [ ] macOS
  • [ ] Web
  • [ ] Windows

Steps to reproduce

Enable any fake location provider then Running [Geolocator.getCurrentPosition] or [Geolocator.getLastKnownPosition] in a background isolate my case was foreground service isolate

[Geolocator.getCurrentPosition] throws Unhandled Exception: ParallelWaitError: The location service on the device is disabled. also the location service is enabled

[Geolocator.getCurrentPosition] throws [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Lookup failed: getLastKnownPosition in @methods in LocationService in package:dawami/core/services/location/location_service.dart

all these function works well in the main isolate and the background service isolate unless I put a fake GPS locati but all

Expected results

To work like the main isolate

Actual results

When enabling fake location app throws exceptions when getting location in background isolates

Code sample

Code sample
[Paste your code here]

Screenshots or video

Screenshots or video demonstration

[Upload media here]

Version

14.0.2

Flutter Doctor output

Doctor output
[Paste your output here]

shehabmohamed0 avatar Aug 27 '25 02:08 shehabmohamed0