setUpMockPlugin function
Implementation
@visibleForTesting
MockedPlugin setUpMockPlugin(
String methodChannelName, {
bool shouldTearDown = true,
}) {
TestWidgetsFlutterBinding.ensureInitialized();
// setMockMethodCallHandler for the plugin specified
final methodChannel = MethodChannel(methodChannelName);
final mockPlugin = MockedPlugin._(methodChannel);
// tearDown mock plugin after test
if (shouldTearDown) {
addTearDown(() => mockPlugin._tearDown());
}
return mockPlugin;
}