I am a few weeks into a flutter. I like it a lot but I have an issue that I don't understand. I used the approach below for a drop drown. It works just fine in the dartpad but Visio throws an error and I am not sure what to do about it. Please help.
Error:
Object? newValue
A value of type 'Object?' can't be assigned to a variable of type 'String'. Try changing the type of the variable, or casting the right-hand type to 'String'.dartinvalid_assignment
Code:
DropdownButton(
hint: Text('Pick a category'),
value: _selectedCategory,
onChanged: (newValue) {
setState(() {
_selectedCategory = newValue;
});
},
items: _categories.map((category) {
return DropdownMenuItem(
child: new Text(category),
value: category,
);
}).toList(),
),