How to change the chart line color to custom color code value in Flutter

Question

Asked by dshukertjr on March 09, 2019 (source).

I am using chart_flutter plug in https://pub.dartlang.org/packages/charts_flutter and I want to change the line color of my TimeSeriesChart?

The code I have right now is this:

final chartdata = [
  charts.Series<VolumePerDay, DateTime>(
    id: 'Workout',
    colorFn: (_, __) => charts.MaterialPalette.lime.shadeDefault,
    // colorFn: (_, __) => Theme.of(context).accentColor,
    domainFn: (VolumePerDay workout, _) => workout.time,
    measureFn: (VolumePerDay workout, _) => workout.volume,
    data: data,
  )
];
return charts.TimeSeriesChart(
  chartdata,
  animate: false,
);

I thought that changing the colorFn property would change the color, but if I comment the line with MaterialPalette and uncomment the Theme color line, it gives me an error. How can I set the chart's line color to a color of my choice using color codes?

Answer

Question answered by Ozcan (source).

Dart colors can be used with ColorUtil method

color: charts.ColorUtil.fromDartColor(Colors.white),
CHARTS DART FLUTTER
SHARE: