I started seeing this error in my DropdownButton
after migrating to null safety.
DropdownButton<String>(
value: myValue,
onChanged: (String string) { // Error
print(string);
},
items: [
DropdownMenuItem(
value: 'foo',
child: Text('Foo'),
),
DropdownMenuItem(
value: 'bar',
child: Text('Bar'),
),
],
)
Error:
The argument type 'void Function(String)' can't be assigned to the parameter type 'void Function(String?)?'.