How can i concat text into "Text widget" with "snapshot.data" Flutter

1.1k views Asked by At

I want to concat text inside a Text widget that contains an snapshot.data, but i couldn't do that for now. This is my code:

                               subtitle: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: <Widget>[
                                    Text(
                                      snapshot.data!.docChanges[index]
                                          .doc['entCourse'],
                                      style: TextStyle(
                                        fontSize: 13,
                                        color: Colors.grey,
                                      ),
                                    ),
                                    Text(
                                      // i think here would be the text to concat: 'Valoration is:'
                                      snapshot.data!.docChanges[index]
                                          .doc['valCourse'],
                                      style: TextStyle(
                                        fontSize: 8,
                                        color: Colors.yellowAccent,
                                      ),
                                    ),
                                  ],
                                ),

what i want is something like this

enter image description here

1

There are 1 answers

0
Tanmoy Karmakar On BEST ANSWER

You can use string interpolation and make it without + operator something like this,

Text("this is sample text ${snapshot.data!.docChanges[index].doc["calCourse"]}"),