flutter_map_animations icon indicating copy to clipboard operation
flutter_map_animations copied to clipboard

Error method 'getWorldWidthAtZoom'

Open thorito opened this issue 1 year ago • 1 comments

With the new version: flutter_map animations: ^0.9.0

When I build for Android I get the following error:

/Users/example/.pub-cache/hosted/pub.dev/flutter_map_animations-0.9.0/lib/src/animated_marker_layer.dart:26:28: Error: The method 'getWorldWidthAtZoom' isn't defined for the class 'MapCamera'.
 - 'MapCamera' is from 'package:flutter_map/src/map/camera/camera.dart' ('/Users/example/.pub-cache/hosted/pub.dev/flutter_map-7.0.2/lib/src/map/camera/camera.dart').
Try correcting the name to the name of an existing method, or defining a method named 'getWorldWidthAtZoom'.
    final worldWidth = map.getWorldWidthAtZoom();

When I build for iOS I get the following error:

Failed to build iOS app
Error (Xcode): /Users/example/.pub-cache/hosted/pub.dev/flutter_map_animations-0.9.0/lib/src/animated_marker_layer.dart:26:28: Error: The method 'getWorldWidthAtZoom' isn't
defined for the class 'MapCamera'.

pubspec.yaml

dependencies:
  flutter_map: ^8.0.0
  flutter_map_animations: ^0.9.0
  flutter_map_cancellable_tile_provider: ^3.1.0
  flutter_map_location_marker: ^9.1.1
  flutter_map_marker_popup: ^7.0.0 // Pending update (not available)

dependency_overrides:
  flutter_map: ^7.0.2 # incompatible with flutter_map_marker_popup

flutter doctor [✓] Flutter (Channel stable, 3.27.3, on macOS 15.3 24D60 darwin-arm64, locale es-ES) [✓] 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) [✓] Android Studio (version 2024.2) [✓] VS Code (version 1.96.4) [✓] VS Code (version 1.82.2) [✓] Network resources

• No issues found!

What is the reason?

Thanks

thorito avatar Feb 05 '25 10:02 thorito

This is most definitely because you are overriding your flutter_map dependency with:

dependency_overrides:
  flutter_map: ^7.0.2

The latest version of flutter_map_animations uses some of the newest APIs provided by flutter_map v8

If flutter_map_marker_popup is not compatible with the latest version of flutter_map then you should stick with v7 and flutter_map_animations v0.8.0 instead of overriding the dependency.

TesteurManiak avatar Feb 05 '25 10:02 TesteurManiak