PAbleBoo
PAbleBoo

Reputation: 65

How to have multiple arguments to a list in Flutter

I have a function which returns a List of ListTiles.


  List<ListTile> tinyImage = [];


  List<ListTile> croppedImages() {
    ListTile newImage =
        ListTile(title: crop1 == null ? Text('No Image') : ListPart());
    tinyImage.add(newImage);
    return tinyImage;
  }

But i want this list to have other arguments like Text, DrawerHeader and other stuffs. Like,

List<ListTile, DrawerHeader> tinyImage = [];

I am trying to create a Drawer. For now i am able to return a list of images with the above function. I want to add a header which is not possible at the moment. Please help me out.

Upvotes: 1

Views: 1720

Answers (1)

Saman Salehi
Saman Salehi

Reputation: 2179

You have to set the list type to something more generic, like Widget.

List<Widget> items = [];
items.add(DrawerHeader());
items.add(ListTile());

Upvotes: 2

Related Questions