mapbox / mapbox/mapbox-maps-flutter

iOS App Crashing When Loading RasterLayer

Open
#718 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

I'm trying to show a heatmap in my Flutter app with the help of RasterSource/Layers. It was working fine in 0.5.0 but after migrating to 2.3.0 it started crashing on iOS. The error thrown in xCode is:

`Generate Mipmaps For Texture Validation [tex mipmapLevelCount](1) must be > 1`

After some investigation I found that there is an issue when the loaded tiles have a size of 1x1. This is also confirmed in one of the comments on this [StackOverflow post ](https://stackoverflow.com/questions/71487688/app-crashing-when-loading-rasterlayer-mipmaps-level-count-must-be-greater-than).

This is the code I'm using in Flutter just in case.

```
await style.addSource(
RasterSource(
id: 'overall_heatmap',
tiles: heatmap.tiles,
tileSize: 256,
scheme: Scheme.XYZ,
minzoom: heatmap.minZoom,
maxzoom: heatmap.maxZoom,
bounds: heatmap.bounds,
),
);

await style.addLayer(
RasterLayer(
id: 'heatmap',
sourceId: 'overall_heatmap',
rasterResampling: RasterResampling.LINEAR,
),
);
```

And this is my Flutter doctor result:

```
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.6.1 23G93 darwin-arm64, locale en-CO)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
```

Thanks in advance for any help you can provide!

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 by reproducing the crash with the provided RasterSource and RasterLayer configuration on iOS, focusing on a loaded raster tile sized 1x1. Then trace the native raster texture or mipmap handling used by this Flutter integration; done means the configuration no longer crashes when such a tile is loaded and the regression is covered by an appropriate test if the repository provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter, ios
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.