0

Issue: I can't refer to the marker itself.

Scenario: Retrieving data from firebase and setting it on variables. What I want is that when I tap any marker on GoogleMaps it should update the variable Marker currentMarker to this marker;

Problem: onTap function exists inside Marker and while creating it i can't refer to itself and set it to currentMarker

Code:

Marker temp = Marker(
          markerId: MarkerId('*******'),
          consumeTapEvents: true,
          onTap: () {
            log('tappedBase');
            currentMarker = ; //How to refer to this temp marker here?
          },
          position: LatLng(0.000000,0.000000));

[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400 darwin-arm, locale en-PK)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!
Anas Yousuf
  • 423
  • 1
  • 6
  • 17
  • I think this can help https://stackoverflow.com/questions/55000043/flutter-how-to-add-marker-to-google-maps-with-new-marker-api – Shiva Burade Nov 25 '22 at 06:01

0 Answers0