mapbox / mapbox/mapbox-maps-flutter
Console gets spammed: Unable to acquire a buffer item... when using MapWidget inside IndexedStack
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 380
- Forks
- 204
- PR merge metrics
- No merged PRs in 30d
Description
## Description:
I'm using MapboxMapsFlutter with MapWidget embedded in a navigation tab that uses an IndexedStack to switch between screens. When I switch away from the tab containing the map (while keeping it in memory), the Android console gets spammed with the following warning:
```
W/ImageReader_JNI(18321): Unable to acquire a buffer item, very likely client tried to acquire more than maxImages buffers
```
This happens even if the map isn’t interacted with, and continues until I switch back.
## Reproduction Steps:
Use MapWidget in a screen inside an IndexedStack.
Navigate to another tab, leaving the map alive but hidden.
Observe console spam from Android logs.
## What I Need:
We want to keep the map alive and stateful across tabs (to preserve camera, markers, etc.), so disposing/reinitializing the map on every tab switch is not ideal.
## Environment:
mapbox_maps_flutter: 2.8.0
Flutter version: 3.32.0
Device: Medium Phone API 35 (Android 15.0) | arm64
## Flutter Doctor
usamaejaz@Usamas-MacBook-Pro ~ % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.0, on macOS 15.1 24B2083 darwin-arm64, locale
en-AE)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] IntelliJ IDEA Community Edition (version 2024.3.2)
[✓] Connected device (5 available)
! Error: Browsing on the local area network for Usama’s iPhone. Ensure the device is unlocked and attached with a cable or
associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• No issues found!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the warning with MapWidget kept alive inside an IndexedStack, then inspect the Android and Flutter lifecycle behavior while the map tab is hidden. Done means the console is no longer spammed when switching tabs, while the map remains alive and preserves its camera and markers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, dart, flutter
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100