-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Getter 'a' is Not Defined for Class 'Color' in axis_chart_data.dart #1846
Comments
Same error over here |
+1 |
Same for me... |
Same for me |
You try old version 0.66.1, I am using it, and this works for me. |
Also having this Error |
same issue, downgraded to 0.69.0 and it works. currently my project is still on Flutter 3.24.4 could that be the cause? |
I am using pie_chart: ^5.0.0 . Its very easy |
running flutter upgrade worked for me |
I’m using fl_chart version 0.69.0, and it seems to be working fine. However, I need to use version 0.70.1 to create a horizontal bar chart. Unfortunately, I’m encountering the same error as you. Can you help me out with this? |
+1 |
1 similar comment
+1 |
Same error over here, but and 0.70.2 |
same error with the latest version of fl_chart |
Tried it out works fine Thanks: 0.66.1 |
+1 Same error over here, but and 0.70.2 Somebody knows if is possible turn arround the BarChart to horizontal direction on another version without this bug? @imaNNeo , help here please! |
+1 same error |
same here |
this happened in new versions . use [0.69.2] version to solve it |
Same issue on Flutter 3.24.5 with fl_chart 0.70.2. Issue is resolved by downgrading to fl_chart 0.69.2. Looks like this issue was introduced in 1998d92 ( diff --git a/lib/src/chart/base/axis_chart/axis_chart_data.dart b/lib/src/chart/base/axis_chart/axis_chart_data.dart
index a71fa600..5f7525d0 100644
--- a/lib/src/chart/base/axis_chart/axis_chart_data.dart
+++ b/lib/src/chart/base/axis_chart/axis_chart_data.dart
@@ -1377,7 +1377,7 @@ class FlDotCirclePainter extends FlDotPainter {
/// Implementation of the parent class to draw the circle
@override
void draw(Canvas canvas, FlSpot spot, Offset offsetInCanvas) {
- if (strokeWidth != 0.0 && strokeColor.opacity != 0.0) {
+ if (strokeWidth != 0.0 && strokeColor.a != 0.0) {
canvas.drawCircle(
offsetInCanvas,
radius + (strokeWidth / 2),
@@ -1474,7 +1474,7 @@ class FlDotSquarePainter extends FlDotPainter {
/// Implementation of the parent class to draw the square
@override
void draw(Canvas canvas, FlSpot spot, Offset offsetInCanvas) {
- if (strokeWidth != 0.0 && strokeColor.opacity != 0.0) {
+ if (strokeWidth != 0.0 && strokeColor.a != 0.0) {
canvas.drawRect(
Rect.fromCircle(
center: offsetInCanvas, I suspect this change was made because the Either the supported Flutter version needs to be bumped (currently it's on Imo, since Flutter has not yet removed the I'd happy to contribute the required changes if that would be helpful 👍 |
Thanks @bcheidemann, on pub.dev the minimum version is 3.2, I think it should be clearer there, 0.70 has dart 3.27 and 0.69 has 3.24 |
Hi @Leozin777, thanks for your comment 🙂 Are you referring to the minimum Dart SDK version listed on pub.dev? I don't believe the Dart SDK version constraint is the issue here. Based on testing and review of the source codes for Flutter and |
oh right, thanks @bcheidemann for your help with this question, I appreciate |
When using the fl_chart package version 0.70.1, I encountered an error in axis_chart_data.dart at line 1409. The getter a is not defined for the class Color. This issue occurs when checking the alpha value of strokeColor in the if condition.
Error: The getter 'a' isn't defined for the class 'Color'.
'Color' is from 'dart:ui'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'a'.
if (strokeWidth != 0.0 && strokeColor.a != 0.0) {
^
Steps to Reproduce:
Add fl_chart version 0.70.1 to a Flutter project.
Use a widget from fl_chart that involves axis-based charts (e.g., LineChart or BarChart).
Run the project.
Expected Behavior: The chart should render without errors.
Actual Behavior: A compilation error occurs due to the use of a non-existent getter a on the Color class.
Additional Information:
Flutter version: [Provide your Flutter version]
Dart version: [Provide your Dart version]
Suggested Fix: Replace the a getter with opacity or use value to get the ARGB components. For example:
if (strokeWidth != 0.0 && strokeColor.opacity != 0.0) {
The text was updated successfully, but these errors were encountered: