Check for empty list

main
Kai Mannweiler 2023-02-27 11:07:46 +01:00
parent cbf384f9e9
commit ba558adecb
1 changed files with 1 additions and 1 deletions

View File

@ -10,7 +10,7 @@ class DropDown extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var inputModel = context.watch<InputProvider>(); var inputModel = context.watch<InputProvider>();
return DropdownButtonFormField<String>( return DropdownButtonFormField<String>(
value: _items[0], value: _items.isEmpty ? null : _items[0],
icon: const Icon(Icons.arrow_downward), icon: const Icon(Icons.arrow_downward),
elevation: 16, elevation: 16,
style: const TextStyle(color: Colors.deepPurple), style: const TextStyle(color: Colors.deepPurple),