我正在尝试在flutter项目中实现dropdownbutton。Dropdownbutton列表将从api中填充。我已经从api获取了列表。
但是当我选择一个项目时,它没有显示。错误消息在下面给出>
The following assertion was thrown building FutureBuilder<List<Categories>>(dirty, state: _FutureBuilderState<List<Categories>>#09534): There should be exactly one item with [DropdownButton]'s value: Instance of 'Categories'. Either zero or 2 or more [DropdownMenuItem]s were detected with the same value 'package:flutter/src/material/dropdown.dart': Failed assertion: line 805 pos 15: 'items == null items.isEmpty value == null || items.where((DropdownMenuItem<T> item) { return item.value == value; }).length == 1'
我还在Pastebin上添加了dropdownbutton代码。
我正在尝试在flutter项目中实现dropdownbutton。Dropdownbutton列表将从api中填充。我已经从api获取了列表。但是当我选择一个项目时,它没有显示。 ...