Flutter: Shared Preferences null on Startup

前端 未结 6 1079
刺人心
刺人心 2021-01-11 12:28

Problem: Shared preference bool value is null on startup even though I have given it a value if prefs.getBool(\'myBool\') returns null

6条回答
  •  轮回少年
    2021-01-11 13:09

    For any one still experiencing this issue, it's because there is still a race condition in the accepted answer.

    To fix it, use this package to wait for the layout to load first

提交回复
热议问题