I wanted to create a checklist for the programming languages I know. I have used Set() to contain the data. But when I use it in the CheckboxListTile() it is not checking the box in the UI. I wanted to do it with using flutter_hooks.
- I have created an enum for ProgrammingLanguages.
enum ProgrammingLanguages { C, DART, PYTHON, JAVASCRIPT }
- Then I have initialised the set in stateless Widget class like this
final _selectedLanguages = useState<Set>(Set<ProgrammingLanguages>());
- In the build I have added a CheckBoxListTile like this.
CheckboxListTile(
title: Text('C'),
value: _selectedLanguages.value.contains(ProgrammingLanguages.C),
onChanged: (value) {
value
? _selectedLanguages.value.remove(ProgrammingLanguages.C)
: _selectedLanguages.value.add(ProgrammingLanguages.C);
}),
But in the final UI I am not able to activate the check box. Please help.