'DropDownMenu with icon flutter

New in flutter. Want to build the drop-down menu list with icon. Doesn't show any error but stop emulator. Please help me to build like this.

[![Click here to see image][2]][2] [![Error in Exceptions][1]][1]

    const catagoryItem = [
    CatagoryItem(name: 'Crypto', iconPath: 'assets/icons/crytoicon.png'),
    CatagoryItem(name: 'Crypto', iconPath: 'assets/icons/crytoicon.png'),
    CatagoryItem(name: 'Crypto', iconPath: 'assets/icons/crytoicon.png'),
    CatagoryItem(name: 'Crypto', iconPath: 'assets/icons/crytoicon.png'),
  ];

 //..
      DropdownButton(items: catagoryItem.map((e) => DropdownMenuItem(child: Row(
            children: [
              SizedBox(
                height: 5.h,
                width: 6.w,
                child: Image.asset(e.iconPath),),
                SizedBox(
                  width: 2.w,
                ),
                Text(e.name,style: TextStyle(fontSize: 16.sp),),

            ],

        ))).toList(), onChanged: null)


  [1]: https://i.stack.imgur.com/toPZp.png
  [2]: https://i.stack.imgur.com/M2V6A.png


Solution 1:[1]

I tried your code (without the flutter_screenutil stuff), it works fine.

I suggest you start by removing those and see if it works, i.e. change width: 2.w to something like width: 8 and whatnot. Also try completely stopping the debug process and restart again, because it might be a hot reload issue too.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 WSBT