I’m using the Syncfusion Chart in my Flutter application, and everything was working fine until I upgraded Flutter to the latest version. Now, I’m encountering the following error during debugging:
Error (Xcode): ../../.pub-cache/hosted/pub.dev/syncfusion_flutter_charts-25.2.6/lib/src/charts/cartesian_chart.dart:1367:22: Error: The method ‘markNeedsBuild’ isn’t defined for the class
I tried the following approaches to resolve the issue:
Cleaning the Flutter build: I ran flutter clean to remove any old build artifacts, followed by flutter pub get to fetch the latest dependencies. I expected this to resolve any potential build issues caused by cached files.
Updating the Syncfusion Chart package: I checked if there was a newer version of the syncfusion_flutter_charts package available and updated it accordingly. I expected that the latest version might have fixes for compatibility with the latest Flutter version.
Running flutter pub get: After upgrading Flutter, I ensured that all dependencies were properly updated by running flutter pub get. I expected this to sync all dependencies with their latest compatible versions.
Checking Flutter and Dart versions: I verified that my Flutter and Dart SDKs were up-to-date and compatible with the dependencies in my pubspec.yaml.
Despite these efforts, the error persists. I expected these steps to resolve any compatibility or caching issues that might be causing the markNeedsBuild method not to be found.
2
Answers
You can check this links:
Link1
Link2
Link3
You can add this to your pubspec.yaml file
credits goes to: Luvti