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

Build error in first time using fl_chart #1853

Open
Leozin777 opened this issue Jan 29, 2025 · 4 comments
Open

Build error in first time using fl_chart #1853

Leozin777 opened this issue Jan 29, 2025 · 4 comments

Comments

@Leozin777
Copy link

Leozin777 commented Jan 29, 2025

I followed the documentation and this error occurred with me

To Reproduce
Run this command:
flutter pub add fl_char
And add this in any page "import 'package:fl_chart/fl_chart.dart';", the error is show in debug terminal

Versions

  • Flutter: ^3.5.3
  • fl_chart: ^0.70.2

Error in debug console:

../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/base/axis_chart/axis_chart_data.dart:1470:43: 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) {
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/base/axis_chart/axis_chart_data.dart:1567:43: 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) {
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/line_chart/line_chart_data.dart:550:35: Error: The method 'withValues' isn't defined for the class 'MaterialColor'.
  • 'MaterialColor' is from 'package:flutter/src/material/colors.dart' ('../../../../flutter/packages/flutter/lib/src/material/colors.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'withValues'.
    ? Colors.blueGrey.withValues(alpha: 0.5)
    ^^^^^^^^^^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/line_chart/line_chart_data.dart:606:35: Error: The method 'withValues' isn't defined for the class 'MaterialColor'.
  • 'MaterialColor' is from 'package:flutter/src/material/colors.dart' ('../../../../flutter/packages/flutter/lib/src/material/colors.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'withValues'.
    ? Colors.blueGrey.withValues(alpha: 0.5)
    ^^^^^^^^^^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/radar_chart/radar_chart_data.dart:300:46: Error: The method 'withValues' isn't defined for the class 'MaterialColor'.
  • 'MaterialColor' is from 'package:flutter/src/material/colors.dart' ('../../../../flutter/packages/flutter/lib/src/material/colors.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'withValues'.
    fillColor = fillColor ?? Colors.cyan.withValues(alpha: 0.2),
    ^^^^^^^^^^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/color_extension.dart:9:20: 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'.
    _floatToInt8(a),
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/color_extension.dart:10:21: Error: The getter 'r' 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 'r'.
    (_floatToInt8(r) * value).round(),
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/color_extension.dart:11:21: Error: The getter 'g' 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 'g'.
    (_floatToInt8(g) * value).round(),
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/color_extension.dart:12:21: Error: The getter 'b' 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 'b'.
    (_floatToInt8(b) * value).round(),
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/base/axis_chart/axis_chart_painter.dart:159:30: 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 (data.backgroundColor.a == 0.0) {
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/border_extension.dart:12:20: 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 (left.color.a == 0.0 &&
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/border_extension.dart:13:19: 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'.
    top.color.a == 0.0 &&
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/border_extension.dart:14:21: 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'.
    right.color.a == 0.0 &&
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/border_extension.dart:15:22: 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'.
    bottom.color.a == 0.0) {
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/bar_chart/bar_chart_painter.dart:339:56: 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 (borderSide.width > 0 && borderSide.color.a > 0) {
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/bar_chart/bar_chart_painter.dart:637:71: 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 (stackItem.borderSide.width == 0 || stackItem.borderSide.color.a == 0) {
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/line_chart/line_chart_painter.dart:1001:47: 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 (!barData.show || barData.shadow.color.a == 0.0) {
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/extensions/paint_extension.dart:8:21: Error: The method 'withValues' isn't defined for the class 'Color'.
  • 'Color' is from 'dart:ui'.
    Try correcting the name to the name of an existing method, or defining a method named 'withValues'.
    color = color.withValues(alpha: 0);
    ^^^^^^^^^^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/pie_chart/pie_chart_painter.dart:146:38: 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'.
    section.borderSide.color.a != 0.0) {
    ^
    ../../../../AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.70.2/lib/src/chart/pie_chart/pie_chart_painter.dart:332:69: 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 (section.borderSide.width != 0.0 && section.borderSide.color.a != 0.0) {
    ^
    Target kernel_snapshot_program failed: Exception
@prejwal-p
Copy link

prejwal-p commented Jan 29, 2025

Seems like the issue is with the new version: 0.70.2
I downgraded to 0.66.1 and things are working fine for me

@Leozin777
Copy link
Author

I downgraded to 0.69.2, but in this version the rotationQuarterTurns property is not available :/

@MaliSyds
Copy link

same , waiting for fix

@elkoDev
Copy link

elkoDev commented Feb 2, 2025

same

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

4 participants