错误:无法将参数类型“ Null Function(DateTime,List <dynamic>)”分配给该参数

时间:2020-10-20 08:32:12

标签: flutter dart

与此同时,我也面临着同样的问题

     Error: 
        The argument type 'Null Function(DateTime, List<dynamic>)' can't be assigned 
        to the parameter type 'void Function(DateTime, List<dynamic>, List<dynamic>)'.
        - 'DateTime' is from 'dart:core'. - 'List' is from 'dart:core'. 
        onDaySelected: (day, events) {

3 个答案:

答案 0 :(得分:2)

那是避免错误的一种方法

onDaySelected: (date, event, _) {
    print(date.toIso8601String());
},

答案 1 :(得分:1)

我遇到了同样的问题。我设法通过传递_作为第三个参数来解决它。

答案 2 :(得分:1)

是的,我也遇到了同样的问题,只需在第三个参数中加上'_就可以解决

onDaySelected: (date, events, _) {
        _onDaySelected(date, events);
        _animationController.forward(from: 0.0);
      },