【发布时间】:2020-04-12 00:49:22
【问题描述】:
声明:
bool switchVariable = true;
代码部分:
SharedPreferences prefs = await SharedPreferences.getInstance();
switchVariable = (prefs.getBool('switchVariable') ?? true);
错误:
Unhandled Exception: type 'String' is not a subtype of type 'bool'
当您选择违规代码的链接时,此错误会特别突出显示:
*switchVariable* = (prefs.getBool('switchVariable') ?? true);
【问题讨论】:
标签: flutter