mapbox / mapbox/mapbox-maps-flutter
Puck layer not added the same way on iOS and Android
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
When you set the puck settings as:
```
mapboxMap?.location.updateSettings(
LocationComponentSettings(
pulsingEnabled: false,
showAccuracyRing: true,
puckBearing: PuckBearing.COURSE,
puckBearingEnabled: true,
),
);
```
You can access the puck layer with:
```
if (Platform.isAndroid) {
puckLayerId = 'mapbox-location-indicator-layer';
} else {
puckLayerId = 'puck';
}
try {
bool? puckLayerExists =
await mapboxMap?.style.styleLayerExists(puckLayerId);
```
However when you use the same code for Android, it fails. The error tells you the puck layer does not exist.
In order to fix this you need to add `enabled: true`
```
mapboxMap?.location.updateSettings(
LocationComponentSettings(
enabled: true, // Needed for Android
pulsingEnabled: false,
showAccuracyRing: true,
puckBearing: PuckBearing.COURSE,
puckBearingEnabled: true,
),
);
```
I think this behavior should be consistent across iOS and Android. So I guess the bug is that when `enabled: true` is not provided on iOS it still adds the puck layer.
Contributor guide
Research direction
Start with LocationComponentSettings.updateSettings and the styleLayerExists call shown in the issue, then compare how the Flutter wrapper configures the location component on iOS and Android. Confirm whether omitting enabled should produce the same puck-layer behavior on both platforms; done means the behavior is consistent and the reported layer lookup no longer differs by platform.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100