Can I format a number before it is rendered in

后端 未结 4 1556
后悔当初
后悔当初 2021-01-07 20:24

I am rendering a node in Flutter app something like:

We have total ${_summary[\'bookCount\']} books. 

_summ

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-07 21:03

    In for loop you can try:

    Text('Index ${i}'), //Index 0
    

    Format with operation:

    Text('Total: \$${price * quantity}'),  //$20
    

    With Decimal point:

    Text('\$${cart.totalAmount.toStringAsFixed(2)}'), //2.34
    

提交回复
热议问题