mardi 4 août 2020

How can use if statement with Container widget in flutter

I want to use if statement with container widget like this code :

if (int.parse(m_id) > int.parse(cm_id) || int.parse(d_id) > 4)
    {
      Container(
         width: 0.23 * size,
         height: 0.23 * size,
         child: Image.asset('assets/images/days/day4k.png'),
     ),
}

But it gets error :

The element type 'Set<Container>' can't be assigned to the list type 'Widget'

is there a way to fix this error ?

Aucun commentaire:

Enregistrer un commentaire