mapbox / mapbox/mapbox-maps-flutter

Source name is not in style

Aperta
#945 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Dart
Stelle
380
Fork
204
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I see these cases since several previous versions, I want to know if we are using the implementation correctly, in case this is correct, how can we solve this exception?

This error does not allow to render on the map (in this case pins, but also polygons).

**Full log native:**

```
data:text/text;charset=utf-8,
PlatformException(Throwable, java.lang.Throwable: Source bikes is not in style, Cause: null, Stacktrace: java.lang.Throwable: Source bikes is not in style
at com.mapbox.maps.mapbox_maps.StyleController.setStyleSourceProperties(StyleController.kt:40)
at com.mapbox.maps.mapbox_maps.pigeons.StyleManager$Companion.setUp$lambda$59$lambda$58(MapInterfaces.kt:40)
at com.mapbox.maps.mapbox_maps.pigeons.StyleManager$Companion.a0(MapInterfaces.kt:1)
at com.mapbox.maps.mapbox_maps.pigeons.o.e(R8$$SyntheticClass:20)
at zi.b$a.a(BasicMessageChannel.java:16)
at oi.b.run(R8$$SyntheticClass:128)
at android.os.Handler.handleCallback(Handler.java:991)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8787)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871)
, null)

When the exception was thrown, this was the stack:
0 StyleManager.setStyleSourceProperties (/home/builder/.pub-cache/hosted/pub.dev/mapbox_maps_flutter-2.6.0/lib/src/pigeons/map_interfaces.dart:6541:7)
```

**Flutter Implementation**

```
try {
final existingSource = await state.controller?.style
.getSource(id)
.catchError((_) => null) as GeoJsonSource?;

if (existingSource != null) {
await existingSource.updateGeoJSON(data);
return existingSource;
} else {
final source = GeoJsonSource(
id: id,
data: data,
cluster: cluster,
clusterMinPoints: clusterMinPoints,
clusterMaxZoom: clusterMaxZoom,
clusterRadius: clusterRadius,
);
await state.controller?.style.addSource(source);
return source;
}
} catch (e) {
debugPrint('MapsCubit Error _addOrUpdateSource layer $id: $e');
return null;
}
```

**Flutter version**
- 3.27.2

**Mapbox version**

- mapbox_maps_flutter: ^2.6.0

**This happens mostly on android devices**

- Samsung Galaxy A53 5G
- Samsung Galaxy S22 Ultra
- Google Pixel 5
- Google Pixel 8
- Huawei P30 Pro
- Motorola moto g32
- Nothing A063

Thanks!

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Start by tracing the getSource and addSource sequence in the Flutter implementation against StyleController.kt:40 and map_interfaces.dart:6541. Reproduce the Android failure with mapbox_maps_flutter 2.6.0 and determine when the source is absent from the style. Done means the source update or creation path no longer produces “Source bikes is not in style” and is covered by a relevant test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
dart, flutter
Ambito
mobile
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.