0

I have the next datas on real time firebase database: example

As you see, there are more data in "animals" , "rocks" and "vegetables". I want get that names in a List of data, something like this:

List list = ["animals","rocks", "vegetables"];

I know how to do a get http request in flutter to get data doing this:

var response =  await http.get('https://mydb.firebaseio.com/prueba.json');
pruebaFirebase = json.decode(response.body);

But it returns a List of collections, and I only need the name of each one names of collections.

Thanks in advance dear community.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Neto Paez
  • 113
  • 1
  • 1
  • 8

1 Answers1

0

Use the shallow query parameter of the Realtime Database REST API:

https://mydb.firebaseio.com/prueba.json?shallow=true
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • Good night Doug, thank you for reply. With that, I got this JSON: ``` {animals:true, rocks: true, vegetables: true} ``` I tried to use that data but I couldn't. I tried to transform it to a LIST with pruebaFirebase = json.decode(response.body) as List; But it dind't run. Do you know a way to solve it? Thanks in advance, Doug. – Neto Paez Apr 01 '19 at 03:26