我的一个单元测试失败,并显示以下内容:
MissingPluginException(No implementation found for method crypto_box_keypair on channel flutter_sodium)
我已经重建,重新加载,重新安装,尝试了较新的版本,进行了flutter clean
,开始了一个新项目并仅复制了我的dart源,但没有任何效果。看来其他插件也有类似的问题,所以我认为这是一个不稳定的问题,但是他们的解决方案均无效。
正在测试的代码:
Future<Map<String, String>> generateKeys () async {
print("Generating");
try {
KeyPair keys = await CryptoBox.generateKeyPair();
print('Keys ' + keys.toString());
} catch (e) {
print(e.toString());
}
return keys;
}
单元测试:
test("Keys should be generated", () async {
User user = new User();
await user.generateKeys();
expect(user.keys, contains("sk"));
});
Flutter Doctor输出:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v0.9.7-pre.25, on Mac OS X 10.14 18A389, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
[✓] Android Studio (version 3.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1)
[✓] VS Code (version 1.28.0)
[✓] Connected device (1 available)
• No issues found!
任何帮助将不胜感激。