【发布时间】:2020-08-02 15:47:30
【问题描述】:
如何在 Flutter 中测试依赖于 path_provider 插件的代码?
对依赖于 path_provider 插件的代码执行测试时,出现以下错误:
MissingPluginException(No implementation found for method getStorageDirectory on channel plugins.flutter.io/path_provider)
package:flutter/src/services/platform_channel.dart 319:7 MethodChannel.invokeMethod
===== asynchronous gap ===========================
dart:async _asyncErrorWrapperHelper
package: mypackage someClass.save
unit_tests/converter_test.dart 19:22
main.<fn>
【问题讨论】:
-
你没有模拟getStorageDirectory吗?
-
我该怎么做?我以前从未使用过模拟
标签: unit-testing flutter flutter-test