Error: Either zero or 2 or more [DropdownMenuItem]s were detected with the same value I/flutter (18363): 'package:flutter/src/material/dropdown.dart':

后端 未结 10 1390
借酒劲吻你
借酒劲吻你 2021-01-17 13:07

Error code Hi I\'m new to flutter and have a question about dropdownbutton regarding using the same values for multiple dropdownbutton.

From my understanding from th

10条回答
  •  -上瘾入骨i
    2021-01-17 13:27

    You can use the same list in multiple DropDownButton. The error you got is because of having more than one same values in the list. For Example, if I change the list to given below where I have two items having the same value, it will throw me an error.

    `final List nameList = [
        "Name1",
        "Name1",
        "Name3",
        "Name4",
        "Name5",
        "Name6",
        "Name7",
        "Name8"
      ];`
    

    Error:

提交回复
热议问题