Create dynamic list for expansion tile from Firestore data

191

You can iterate over the array and sort the data as List for each category. Say you got 3 List ie. makeup, hair, and men's. Now you can use the spread operator to make the final List

Example

final List<Entry> data = [
  Entry(
    'Makeup',
     ...makeup
  ),
  Entry(
    'Hair',
     ...hair
  ),
  Entry(
    'Men`s',
     ...mens
  ),
]
Share:
191
Can Kaplan
Author by

Can Kaplan

Currently building a marketplace in the beauty service industry.

Updated on December 20, 2022

Comments

  • Can Kaplan
    Can Kaplan over 1 year

    I would like to create a dynamic expansionTile, which receives as input data from Cloud Firestore.

    Currently I download the data as array from Firebase and sort it into 3 different arrays ("Makeup", "Hair", Men's"). Data structure Firestore

    But I have to create a list according to the following scheme:

    How the List should look like

    How can I merge the three lists to one such list?

    enter image description here

    • Sidak
      Sidak almost 4 years
      When you say dynamic ExpansionTile, do you mean you want an ExpansionTile for each Entry?
  • Can Kaplan
    Can Kaplan almost 4 years
    However, the data structure does not consist of 3 arrays, but 3 json structures. I added another picture to my question... Could you help?