Flutter Secure Storage写入无法在Web上正常工作-Nosuchmethoderror:找不到方法:' generatekey'在null上
使用Flutter Secure Storage来存储数据问题。 只有当我使用某些服务器(例如Apache2)托管版本Web构建时,才会看到问题。 在使用Flutter Run -D Chrome运行应用程序时,它可以正常工作。 此外,iOS和Android版本的发行版本都可以正常运行。
我得到的问题是: nosuchmethoderror:找不到方法:null上的'GenerateKey'
代码:
if (isMasterPasswordCorrect == true) {
print(
'master password is correct-----');
print(masterPasswordController.text);
final secureStorage =
new FlutterSecureStorage();
try {
print(
'writing master password data into secure storage');
await secureStorage.write(
key: 'masterPassword',
value: masterPasswordController
.text);
print(
'reading master password from secure storage');
_isMasterPasswordPresent =
await secureStorage.read(
key: 'masterPassword');
print(
'${_isMasterPasswordPresent}');
} catch (e) {
print(e);
}
}
输出
main.dart.js:21714 master password is correct-----
main.dart.js:21714 14000
main.dart.js:21714 writing master password data into secure storage
main.dart.js:21714 NoSuchMethodError: method not found: 'generateKey' on null
Having issue with storing data using flutter secure storage.
Issue is seen only when I host the release web build with some server (like apache2).
While runing the app using flutter run -d chrome, it is working fine.
Also the release version for iOS and android versions are working fine.
The issue I am getting is:NoSuchMethodError: method not found: 'generateKey' on null
Code:
if (isMasterPasswordCorrect == true) {
print(
'master password is correct-----');
print(masterPasswordController.text);
final secureStorage =
new FlutterSecureStorage();
try {
print(
'writing master password data into secure storage');
await secureStorage.write(
key: 'masterPassword',
value: masterPasswordController
.text);
print(
'reading master password from secure storage');
_isMasterPasswordPresent =
await secureStorage.read(
key: 'masterPassword');
print(
'${_isMasterPasswordPresent}');
} catch (e) {
print(e);
}
}
Output
main.dart.js:21714 master password is correct-----
main.dart.js:21714 14000
main.dart.js:21714 writing master password data into secure storage
main.dart.js:21714 NoSuchMethodError: method not found: 'generateKey' on null
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论