Flogs icon indicating copy to clipboard operation
Flogs copied to clipboard

Error in unit test - MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)

Open medleykupps opened this issue 4 years ago • 2 comments

I'm unit testing a service that relies on FLog.

My service's method contains a logging statement, FLog.info(text: 'message'); that results in the following error:

MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)

When I change the logging call to FLog.trace(text: 'message');, it works fine...guessing because it doesn't actually try and write a log entry.

Is there a way around this? Can I mock the FLog method calls? Or, do I need to create my own logging interface that calls FLog internally, and, then mock that interface in my unit tests?

medleykupps avatar Sep 09 '20 06:09 medleykupps

Solution from @asidt could help you: https://github.com/flutter/flutter/issues/10912#issuecomment-587403632

slc1973 avatar Sep 24 '20 14:09 slc1973

@slc1973 The solution in your link used to work. But since 2.10.5 I keep getting this error, described in this issue. Any other solutions?

danielRi avatar May 04 '22 10:05 danielRi