1

How can I convert my below codes to currency Dart/Flutter?

There is a class named number format in flutter, but I could not quite figure it out. Can you please help about the issue.

Example "$ 3,500.00"

 @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        Text(
          "Toplam Masraf: ",
          style: TextStyle(
              color: Colors.orange.shade500,
              fontSize: 15,
              fontWeight: FontWeight.w600),
        ),
        Text(
          
            toplam >= 0 ? "${toplam.toStringAsFixed(2)}" : "0.00".toString(),
          
          style: TextStyle(
              color: Colors.orange.shade900,
              fontSize: 20,
              fontWeight: FontWeight.w800),
    ),
        Text(
          "₺",
          style: TextStyle(
              color: Colors.orange.shade900,
              fontSize: 25,
              fontWeight: FontWeight.w800),
        )
      ],
    );
  }
2

1 Answer 1

2

Maybe the NumberFormat class will help you: https://api.flutter.dev/flutter/intl/NumberFormat-class.html

Did you try the examples?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.