mapbox / mapbox/mapbox-maps-flutter
ArgumentError when calling _tileStore.setMapboxAPIUrl with Uri
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
**Description:**
I encountered an issue when calling `_tileStore.setMapboxAPIUrl(Uri.parse('https://api.mapbox.com/'));`. This results in the following exception:
```
ArgumentError (Invalid argument: Instance of '_SimpleUri')
```
### Steps to Reproduce:
1. Call `_tileStore.setMapboxAPIUrl(Uri.parse('https://api.mapbox.com'));`
2. Observe the exception being thrown.
### Expected Behavior:
The function should accept the parsed URI and not throw an `ArgumentError`.
### Actual Behavior:
The function throws `ArgumentError (Invalid argument: Instance of '_SimpleUri')`.
### Possible Cause:
It seems like `_tileStore.setMapboxAPIUrl` might be expecting a `String` instead of a `Uri` object, as described in its documentation: "Accepts a string, or null for resetting to the default value." If this is the case, the method should ensure proper type handling.
### Environment:
- **Package Version:** 2.5.1
- **Platform:** Android and iOS
### Additional Context:
Any insights into whether this is an expected behavior or a bug would be appreciated. If `_tileStore.setMapboxAPIUrl` is meant to accept a `Uri`, it might need an update to handle this exception properly.
Thanks!
Contributor guide
Research direction
Start by locating the _tileStore.setMapboxAPIUrl entry point and its documented argument type. Reproduce the failure with Uri.parse and compare it with a string or null input; done means the documented behavior is consistent and the Uri case has a verified outcome on Android and iOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100