📜  在 Flutter Web 中查找所选项目的索引 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:20.055000             🧑  作者: Mango

代码示例1
getDropDownMenuItems(snapshot) {
    Map mapWithIndex = snapshot.data.services.asMap;
    List _items = [];
    mapWithIndex.forEach((index, item) {
      _items.add(
        DropdownMenuItem(
          value: index,
          child: Text(item.service),
        ),
      );
    });
    return _items;
  }