Building and registering the host portion of a plugin
is part of the Flutter application build process,
so plugins only work when your code is running
in your application, such as with flutter run
or when running integration tests.
When running Dart unit tests or
widget tests, the host code isn’t available.
If the code you are testing calls any plugins,
this often results in errors like the following:

MissingPluginException(No implementation found for method someMethodName on channel some_channel_name)

Note:
  Plugin implementations that only use Dart
  will work in unit tests. This is an implementation
  detail of the plugin, however,
  so tests shouldn’t rely on it.

When unit testing code that uses plugins,
there are several options to avoid this exception.
The following solutions are listed in order of preference.

Wrap the plugin

In most cases, the best approach is to wrap plugin
calls in your own API,
and provide a way of mocking your own API in tests.