【发布时间】:2020-05-07 04:41:38
【问题描述】:
我试图在颤振项目中实现下拉按钮。下拉按钮列表将从 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 上添加下拉按钮代码。
【问题讨论】:
标签: android ios flutter dart flutter-layout