Flutter 如何在显示列表数据之前添加美元符号?

Flutter 如何在显示列表数据之前添加美元符号?,flutter,Flutter,我需要在int之前显示一个美元符号。我试图添加它并从中退出,但它显示了一个错误。在最后一个Text()小部件中,需要将其添加到位置[index].amount.toString()之前。我该如何正确地做到这一点 body: Container( child: ListView.builder( itemCount: locations.length, shrinkWrap: true, itemBuilder

我需要在int之前显示一个美元符号。我试图添加它并从中退出,但它显示了一个错误。在最后一个Text()小部件中,需要将其添加到位置[index].amount.toString()之前。我该如何正确地做到这一点

      body: Container(
        child: ListView.builder(
          itemCount: locations.length,
          shrinkWrap: true,
          itemBuilder: (context, index) {
            return Padding(
              padding: EdgeInsets.symmetric(vertical: 1.0, horizontal: 4.0),
              child: Card(
                color: (index % 2 == 0) ? greycolor : Colors.white,
                child: Container(
                    height: 60,
                    padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: <Widget>[
                        Text(locations[index].date,
                            style: TextStyle(fontSize: 20),
                            textAlign: TextAlign.left),
                        Container(
                            margin: EdgeInsets.only(right: 112),
                            child: Text(locations[index].location,
                                style: TextStyle(
                                    fontSize: 20, fontWeight: FontWeight.bold),
                                textAlign: TextAlign.center)),
                        Text(locations[index].amount.toString(),
                            style: TextStyle(fontSize: 20),
                            textAlign: TextAlign.right)
                      ],
                    )),
              ),
            );
          },
        ),
主体:容器(
子项:ListView.builder(
itemCount:locations.length,
收缩膜:对,
itemBuilder:(上下文,索引){
返回填充(
填充:边缘设置。对称(垂直:1.0,水平:4.0),
孩子:卡片(
颜色:(索引%2==0)?灰色:Colors.white,
子:容器(
身高:60,
填充:来自LTRB(0,20,0,0)的边插入集,
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
文本(位置[索引])。日期,
样式:TextStyle(字体大小:20),
textAlign:textAlign.left),
容器(
页边距:仅限边集(右:112),
子项:文本(位置[索引])。位置,
样式:TextStyle(
fontSize:20,fontWeight:fontWeight.bold),
textAlign:textAlign.center),
文本(位置[索引].amount.toString(),
样式:TextStyle(字体大小:20),
textAlign:textAlign.right)
],
)),
),
);
},
),
这项工作:

文本(
“\$${locations[index].amount}”,
样式:TextStyle(字体大小:20),
textAlign:textAlign.right,
);