Plugins in Flutter tests

Packages & plugins

Plugin tests

Wrap the plugin

Mock the plugin’s public API

Mock the plugin’s platform interface

Mock the platform channel

Note:
  To learn how to avoid crashes from a plugin when
  testing your Flutter app, read on.
  To learn how to test your plugin code, check out
  Testing plugins.

Almost all Flutter plugins have two parts:

Dart code, which provides the API your code calls.

Code written in a platform-specific (or “host”) language,
such as Kotlin or Swift, which implements those APIs.

In fact, the native (or host) language code distinguishes
a plugin package from a standard package.