Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: The argument type 'Null Function(DateTime, List<dynamic>)' can't be assigned to the parameter

Tags:

flutter

dart

I am facing the same issue with this

     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) {
like image 258
Hamza Tahir Avatar asked Oct 20 '20 08:10

Hamza Tahir


3 Answers

That is one way how to avoid the error

onDaySelected: (date, event, _) {
    print(date.toIso8601String());
},
like image 78
blckCoach Avatar answered Nov 16 '22 16:11

blckCoach


yeah I was also having the same issue it just got solved by putting ' _ ' in the third argument

onDaySelected: (date, events, _) {
        _onDaySelected(date, events);
        _animationController.forward(from: 0.0);
      },
like image 5
Spsnamta Avatar answered Nov 16 '22 16:11

Spsnamta


I managed to solve it by passing _ as the third argument.

like image 4
Yaro Avatar answered Nov 16 '22 18:11

Yaro