googlemaps / googlemaps/flutter-navigation-sdk

[Feature request]: Marker IDs are forcibly overwritten regardless of user-specified IDs

Open
#288 3 comments 0 reactions 1 assignee Claimed by @illuminati1911 View on GitHub
priority: p2 status: investigating type: feature request
Dominant language
Dart
Stars
75
Forks
54
Avg merge
4d 2h
Merged PRs (30d)
5

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Use case

## Description
There is an issue in the current implementation where user-specified marker IDs are ignored and new IDs are forcibly generated internally. This makes it difficult to manage, update, or delete individual markers.

### Current Behavior
In `common_view_api.dart`, `_createMarkerId()` always generates a new ID, overwriting any ID that may have been set in `MarkerOptionsDto`:

```dart
final List markersToAdd = options
.map((MarkerOptionsDto options) =>
MarkerDto(markerId: createMarkerId(), options: options))
.toList();
```

### Proposal

The implementation should prioritize user-specified IDs and only auto-generate IDs when none are provided:

```dart
final List markersToAdd = options
.map((MarkerOptionsDto options) =>
MarkerDto(
markerId: options.markerId ?? createMarkerId(),
options: options
))
.toList();
```

- Preserves user-specified marker IDs
- Enables easier management of individual markers
- Allows reliable updating and deletion of existing markers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.