Flutter text data if coming null?

Issue

There is such a code and if the user is logged in as a visitor, it prints null because there is no e-mail information, how can I show it blank?

 Text(
    '$successmail \n\n'  
    style: TextStyle(
    fontSize: 22.0,
    fontStyle: FontStyle.normal,
    fontWeight: FontWeight.w300,
    color: Colors.black,
    letterSpacing: 0,
    ),
    ),

I tried putting things like question marks at the end of the variable but I don’t know how to do it exactly.

Solution

On text widget try this:
"${sucessful ?? "No email"} \n \n"

Answered By – Usama majid

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.