I change the String to Double? but I got this error. Please help me solve the problem. Thank you.
product.dart file (These was String before)
class Product {
double ogPrice;
double price;
productdetails.dart. Here's a file that has an error.
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
'${Config().currency}${(widget.product.price)}',
style: GoogleFonts.poppins(
color: Colors.green.shade700,
fontSize: 16.0,
fontWeight: FontWeight.w600,
letterSpacing: 0.3,
),
),
SizedBox(
width: 5.0,
),
Text(
'${Config().currency}${widget.product.ogPrice}',
style: GoogleFonts.poppins(
color: Colors.black54,
decoration: TextDecoration.lineThrough,
fontSize: 15.0,
fontWeight: FontWeight.w500,
letterSpacing: 0.3,
),
),
],
),
And I got this error
lib/widgets/product_detail.dart:43:43: Error: The argument type 'double' can't be assigned to the parameter type 'String'. (int.parse(widget.product.price) /
question from:
https://stackoverflow.com/questions/66060983/how-to-change-the-string-to-double-in-flutter 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…