imaNNeo / imaNNeo/fl_chart

Build error in first time using fl_chart

Open
#1,853 11 comments 5 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
7.6k
Forks
2k
Avg merge
9d 1h
Merged PRs (30d)
2

Description

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

Contributor guide

Open the contributing guide

Research direction

Reproduce the build with Flutter 3.5.3 and fl_chart 0.70.2, then inspect the reported files under lib/src/chart and lib/src/extensions, especially the Color-related errors. The work is done when the package builds successfully in that environment without the reported Color getter and method errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.