0
`final dbRef = database.child("Blocos");
  dbRef.onValue.listen((event) => {
    event.snapshot.children.forEach((child) {
      if (child.key != null) {
       item.add(child.key.toString());
      }
    })
  });
  print(item);

Firebase Rtdb

when I print it only appears [], how do I make a list of the type [word1, word2] appear? I intend to use the list to make a dropdownbutton afterwards.

Salocin
  • 1
  • 1

1 Answers1

0

first, you need to check, is "blocos" has data or not. You can print on event curly brackets first. I think, the mistakes is you're not make sure, is "blocos" has data or not. Hopefully can help you. Thank you

James Indra
  • 51
  • 1
  • 2
  • I have data in the database, I believe that the problem is the execution of the program. But i dont have any idea how to solve it. – Salocin Jan 19 '23 at 19:13