title: Flutter conditional list
body: <p>I want to show list of data when i choose from dropdown, but still error LateInitializationError: Field 'listTanaman' has not been initialized. i just initialize the variable and don't assign value to the variable.</p>
  <p>i'm initialize the varibale like this</p>
  <pre><code>List&lt;Komoditas&gt;? listTanaman;
  </code></pre>
  <p>and assign in this dropdown</p>
  <pre><code>DropdownButton(
      value: dropdownValue,
      items: snapshot.data!.docs
          .map((DocumentSnapshot doc) {
        return DropdownMenuItem(
          value: doc.id,
          child: Container(
            decoration: BoxDecoration(
                borderRadius:
                    BorderRadius.circular(5)),
            height: 100,
            padding: const EdgeInsets.all(10),
            child: Text(doc.get('nama')),
          ),
        );
      }).toList(),
      onChanged: (newValue) {
        setState(() {
          dropdownValue = newValue.toString();
          kategori = snapshot.data!.docs
              .where((newValue) =&gt; true)
              .first
              .get('nama');
        });
        db
            .collection('kategori')
            .doc(dropdownValue)
            .collection(kategori!)
            .snapshots()
            .map((event) =&gt; listTanaman);
      }),
  </code></pre>
  <p><a href="https://i.stack.imgur.com/f0rAu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f0rAu.png" alt="enter image description here" /></a></p>
  <p>anyone know where is my fault ?</p>