Flutter shared_preferrence报错

Flutter shared_preferrence报错

  • 在main函数中runApp之前添加**WidgetsFlutterBinding.ensureInitialized();确保初始化成功
void main(){

  WidgetsFlutterBinding.ensureInitialized();
  
  ...
}
posted @ 2021-11-18 14:31  R1cardo  阅读(10)  评论(0编辑  收藏  举报