'the argument type'List<EntryJob> Function(List<Entry>?, List<Job>?)' can't be assigned to 'List<EntryJob> Function(List<Entry>, List<Job>)'

enter image description here

enter image description here

error: The argument type 'List< Entry Job > Function(List?, List?)' can't be assigned to the parameter type 'List Function(List, List)'. (argument type not assignable at lib\App\home\entries\entries_bloc.dart:33)



Solution 1:[1]

Why is your function taking two nullable lists? Especially when the first thing you do is slap a ! behind, because you think you know better than your compiler?

You need to read a tutorial on null-safety, because this is not how you do it.

Remove the ? behind the two lists in your parameters to make those lists non-nullable. Not only did you assume that anyway, but it is what is required as a signature by combineLatest2s third parameter.

Solution 2:[2]

I think you should use this:

Stream<List<EntryJob>> get _allEntriesStream => Rx.combineLatest2(
database.entriesStream(),
database.jobsStream(),
_entriesJobsCombiner,
);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nvoigt
Solution 2 Asif Shah