我正在尝试打电话playRefreshBar
在我的代码中,但我收到这样的警告
无法从静态方法访问实例成员
这是我的静态代码
static List<charts.Series<Spending, String>> createRandomData(){
Timer(Duration(milliseconds:1000),(){
playRefreshBar();
});
}
代码播放RefreshBar
void playRefreshBar() {
timer = Timer.periodic(Duration(milliseconds: refreshTime), (Timer t){
final random = new Random();
final data = [
new Spending('2013', random.nextInt(1000000)),
new Spending('2014', random.nextInt(1000000)),
new Spending('2015', random.nextInt(1000000)),
new Spending('2016', random.nextInt(1000000)),
new Spending('2017', random.nextInt(1000000)),
new Spending('2018', random.nextInt(1000000)),
new Spending('2019', random.nextInt(1000000)),
];
return[
new charts.Series(id: 'Spending',
data: data,
domainFn: (Spending sp, _) => sp.year,
measureFn: (Spending sp , _) => sp.spending,
labelAccessorFn: (Spending sp, _) => '${sp.year}: \$${sp.spending}'
)
];
});
}