How to access elements of a dynamic object in flutter/dart

I have a dynamic object from snapshot which looks like ;

 {allfruits: fruitInfo{fruitname: orange, fruitcolor: orange, 
 fruitquantity: 2, 
  fruitunit: kg}}

This is the code;

body: FutureBuilder(
    future: fruitList(),
    builder: (BuildContext context, snapshot) {
     var fruit=snapshot.data;

     return ListView(
       padding: EdgeInsets.all(25),

       children: [
         TextFormField(initialValue: FirebaseAuth.instance.currentUser?.email,style:TextStyle(fontWeight: 
        
         Text(fruit,style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18)),

how can i access individual elements from this like fruitcolor or fruitquantity.



from Recent Questions - Stack Overflow https://ift.tt/3EU22dz
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation