skip to Main Content

How to fix this problem this string cannot be provided in the text widget.
How can I solve this? My code:
code

2

Answers


  1. I think the problem is that fullName is of type String? instead of String. That means you need to ensure it is not null.

    Either by enforcing a null check

    Text(fullName!)
    

    or by providing a fallback value

    Text(fullName ?? 'fallback')
    

    or by only showing the text if fullName is not null like

    if (fullName != null)
      Text(fullName)
    
    Login or Signup to reply.
  2. Because your fullName text canbe null, try handle fullName null case:

    Text(
          fullName ?? '',
          style: boldTextStyle.copyWith(fontSize: 18),
        )
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search