Boolean expression must not be null?

前端 未结 4 1099
慢半拍i
慢半拍i 2021-01-23 20:46

Does anyone know why i got the Failed assertion: boolean expression must not be null. If I had logged in and quit the app and open the app again i should be directly in the home

4条回答
  •  抹茶落季
    2021-01-23 21:00

    If your 'value' here can become null - you get the error. To be safe change the line inside setState to:

    userIsLoggedIn = value ?? false; 
    

    it will set the bool to false if value is null

提交回复
热议问题