Baseflow / Baseflow/flutter-geolocator
[Bug]: Does not timeout if permission not answered
- Dominant language
- Dart
- Stars
- 1.3k
- Forks
- 803
- Avg merge
- 8h 16m
- Merged PRs (30d)
- 1
Description
### Please check the following before submitting a new issue.
- [X] I have searched the [existing issues](https://github.com/baseflow/flutter-geolocator/issues).
- [X] I have carefully [read the documentation](https://github.com/Baseflow/flutter-geolocator/blob/main/geolocator/README.md) and verified I have added the required platform specific configuration.
### 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
```dart
await Geolocator.getCurrentPosition(
desiredAccuracy: desiredAccuracy,
timeLimit: Duration(seconds: timeout),
)
```
To make it timeout I am forced to have it like that :
```dart
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
```console
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!
```
Contributor guide
Research direction
Start by reproducing the web case with Geolocator.getCurrentPosition and a one-second timeLimit while leaving the location permission unanswered. Trace the web implementation of that entry point and verify that the returned operation completes with a timeout after one second, without requiring an additional Future.timeout wrapper.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100