DropDownItems<T> static method

List<DropdownMenuItem<T>>? DropDownItems<T>(
  1. List<T> stateData,
  2. String displayFunc(
    1. T
    )
)

Implementation

static List<DropdownMenuItem<T>>? DropDownItems<T>(
  List<T> stateData,
  String Function(T) displayFunc,
) {
  return stateData
      .map<DropdownMenuItem<T>>((value) => DropdownMenuItem<T>(
            value: value, // add this property an pass the _value to it
            child: Row(
              children: [
                Padding(
                  padding: const EdgeInsets.only(top: 7),
                  child: Text(displayFunc(value)),
                ),
              ],
            ),
          ))
      .toList();
}