I am using charts_flutter in my Flutter app and currently I am trying to implement this chart: https://google.github.io/charts/flutter/example/combo_charts/scatter_plot_line.
This is my Series for the line in the chart:
charts.Series(
measureFn: ((dynamic number, _) async => await analyticsLinearRegression.predict(number * 1.0)),
domainFn: ((dynamic number, _) async => await analyticsLinearRegression.predict(number * 1.0)),
colorFn: (dynamic number, _) => charts.ColorUtil.fromDartColor(Colors.blue[900]),
id: "linearRegression",
data: [
0,
highestX,
],
)..setAttribute(charts.rendererIdKey, "linearRegressionLine")
The problem is obvious: The argument type 'Future<double> Function(dynamic, int)' can't be assigned to the parameter type 'num Function(dynamic, int)'.
I understand where the problem is, but the function analyticsLinearRegression.predict returns Future<double> and not double, I can't change that.
So how can I use the data from the analyticsLinearRegression.predict function here for the Series of the line?