Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimateCamera is broken with Flutter 3.27.0 #1433

Open
TBA-Lucas opened this issue Jan 14, 2025 · 2 comments
Open

AnimateCamera is broken with Flutter 3.27.0 #1433

TBA-Lucas opened this issue Jan 14, 2025 · 2 comments

Comments

@TBA-Lucas
Copy link

Now that mapbox_gl is able to compile to 3.27.0 (🎉🎉🎉), a new issue has cropped up with animateCamera:

Uncaught Error: Null check operator used on a null value
    at mapbox_web_gl_platform.dart:209:18
    at _wrapJsFunctionForAsync_closure.$protected (async_patch.dart:311:19)
    at _wrapJsFunctionForAsync_closure.call$2 (async_patch.dart:336:23)
    at Object._asyncStartSync (async_patch.dart:241:3)
    at MapboxWebGlPlatform.animateCamera$body$MapboxWebGlPlatform (mapbox_web_gl_platform.dart:200:11)
    at MapboxWebGlPlatform.animateCamera$2$duration (mapbox_web_gl_platform.dart:200:11)
    at controller.dart:298:12
    at _wrapJsFunctionForAsync_closure.$protected (async_patch.dart:311:19)
    at _wrapJsFunctionForAsync_closure.call$2 (async_patch.dart:336:23)
    at Object._asyncStartSync (async_patch.dart:241:3)

Workaround: moveCamera still works.

Would be awesome to have this fixed (I have no idea how, maybe it has to do with the optional animation duration?), since the animation is a really awesome and neat part of the framework!

@TBA-Lucas
Copy link
Author

TBA-Lucas commented Jan 22, 2025

(Weirdly enough it only produces the error when in --release or --profile mode, not in --debug.)

I saw that there are supposedly some fixes in a fork of mapbox_gl for flutterflow, can't find the code for the changes though - but maybe that'll help narrowing the issue down:

https://pub.dev/packages/mapbox_gl_flutterflow/changelog

@red-gecko27
Copy link

For the web version, the package is based on mapbox_gl_dart, which hasn't been updated recently. It uses the js package that should be replaced by dart:js_interop.

Recent Flutter versions have compatibility issues with the old js package, causing interoperability failures. I successfully fixed the bug by migrating from js to js_interop, referencing the implementation in Ocell-io/mapbox-gl-dart's new-js_interop (see issue #1428).

Without an official update, this package risks becoming deprecated in newer Flutter versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants