flutter percentage of number data in Text widget

Issue

I want to calculate percent of double type data in text widget.

Padding(
      padding: EdgeInsets.fromLTRB(5, 1, 5, 10),
      child: Text(    data[numberdata].toString(), //I want to calculate 5 percent of this numberdata



    style:  GoogleFonts.montserrat(color: Colors.black87, fontSize: 18 , textStyle: 
            TextStyle(fontWeight: FontWeight.w400)),
                    textAlign: TextAlign.center,
                  ),
                ),

Solution

A bit tricky to be sure what you are after. But my best guess is:

Text((data[numberdata]*0.05).toString()),

Answered By – Robert Sandberg

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published