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

Time:01-05

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

CodePudding user response:

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

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