mapbox / mapbox/mapbox-maps-flutter

To make a draggable icon of a layer I need to remove source and layer and add back a new source and layer with updated values. Is this the way to do it?

Open
#330 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
380
Forks
204
PR merge metrics
No merged PRs in 30d

Description

Future<void> onTap(ScreenCoordinate value) async {
  await mapboxMap.style.removeStyleLayer('layer');
  mapboxMap.style.removeStyleSource('point-source');
  final geojson = loadGeoJson(coords: [value.y, value.x]);
  await addPointSource(geojson);
  addLayer();
}

Per example. If I want to update the icon position onTap I remove the source, then layer, then I create a new geojson with updated coordinates and then I add source and layer again. Is this how we should do it?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the onTap handler shown in the issue and review the style.removeStyleLayer and removeStyleSource calls, along with the referenced example. Determine whether updating the icon position requires rebuilding the source and layer or whether the SDK provides another documented path. Done means a maintainer-confirmed usage recommendation or a clearly scoped API change.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.