A null check operator exception is thrown when trying to load (cache) infinite tiled maps
The map is loaded in chunks or the chunks are consoladated
Simply use an infinite map.
[β] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.22621.2428], locale de-DE)
β’ Flutter version 3.13.9 on channel stable at C:\Users\xxxxx\Coding\_sdks\flutter
β’ Upstream repository https://github.com/flutter/flutter.git
β’ Framework revision d211f42860 (3 weeks ago), 2023-10-25 13:42:25 -0700
β’ Engine revision 0545f8705d
β’ Dart version 3.1.5
β’ DevTools version 2.25.0
[β] Windows Version (Installed version of Windows is version 10 or higher)
[X] Android toolchain - develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[β] Chrome - develop for the web
β’ Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[β] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.5)
β’ Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
β’ Visual Studio Community 2022 version 17.7.34202.233
β’ Windows 10 SDK version 10.0.22621.0
[!] Android Studio (not installed)
β’ Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[β] IntelliJ IDEA Ultimate Edition (version 2023.2)
β’ IntelliJ at C:\Users\xxxxx\AppData\Local\Programs\IntelliJ IDEA Ultimate
β’ Flutter plugin version 76.2.4
β’ Dart plugin version 232.10072.19
[β] VS Code (version 1.84.0)
β’ VS Code at C:\Users\xxxx\AppData\Local\Programs\Microsoft VS Code
β’ Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[β] Connected device (3 available)
β’ Windows (desktop) β’ windows β’ windows-x64 β’ Microsoft Windows [Version 10.0.22621.2428]
β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 119.0.6045.124
β’ Edge (web) β’ edge β’ web-javascript β’ Microsoft Edge 119.0.2151.58
[β] Network resources
β’ All expected network resources are available.
! Doctor found issues in 2 categories.
flame_tiled
version: 1.14.1ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
#0 OrthogonalTileLayer.cacheTiles (package:flame_tiled/src/renderable_layers/tile_layers/orthogonal_tile_layer.dart:25:36)
#1 FlameTileLayer.refreshCache (package:flame_tiled/src/renderable_layers/tile_layers/tile_layer.dart:181:5)
#2 RenderableTiledMap._refreshCache (package:flame_tiled/src/renderable_tile_map.dart:365:13)
#3 new RenderableTiledMap (package:flame_tiled/src/renderable_tile_map.dart:64:5)
#4 RenderableTiledMap.fromTiledMap (package:flame_tiled/src/renderable_tile_map.dart:300:12)
This bug is caused because (as far as I can see all) FlameTileLayer's force-unwrap layer.tileData
however with the current tiled
implementation this can be null if the map is infinite and therefore split into chunks.
I see two possible solutions:
Since finite maps are fine for my use case I probably won't be able to contribute a PR to this!
For the time being I think a warning in the docs that infinite maps are not support would be appropriate!
(I didn't find one so far, I hope I didn't miss it π
)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too