Skip to content

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

@shehabmohamed0

Description

@shehabmohamed0

Please check the following before submitting a new issue.

Please select affected platform(s)

  • 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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions