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

[Bug]: Does not timeout if permission not answered

Open HeropolisDa2ny opened this issue 1 year ago • 0 comments

Please check the following before submitting a new issue.

Please select affected platform(s)

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

Steps to reproduce

I build my app using the web option and do not accept any permission related to the location. I request the location via a getCurrentPosition with a timeout of 1s.

Expected results

A timeout after 1 second.

Actual results

Never timeouts.

Code sample

Code sample
await Geolocator.getCurrentPosition(
    desiredAccuracy: desiredAccuracy,
    timeLimit: Duration(seconds: timeout),
)

To make it timeout I am forced to have it like that :

await Geolocator.getCurrentPosition(
    desiredAccuracy: desiredAccuracy,
    timeLimit: Duration(seconds: timeout),
).timeout(Duration(seconds: timeout));

Screenshots or video

Screenshots or video demonstration

[Upload media here]

Version

^13.0.1

Flutter Doctor output

Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.24.0, on macOS 14.6.1 23G93 darwin-arm64, locale en-MX)
    • Flutter version 3.24.0 on channel stable at /Users/[USER]/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 80c2e84975 (6 weeks ago), 2024-07-30 23:06:49 +0700
    • Engine revision b8800d88be
    • Dart version 3.5.0
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/[USER]/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.92.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.96.0

[✓] Connected device (5 available)
    • Core M5 (mobile)                • ec4ad0bb                  • android-arm64  • Android 12 (API 31)
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.6.1 23G93 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.6.1 23G93 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 128.0.6613.137

[✓] Network resources
    • All expected network resources are available.

• No issues found!

HeropolisDa2ny avatar Sep 11 '24 18:09 HeropolisDa2ny