Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guidance on testing / MissingPluginException event.scanResult #134

Open
dlewis2017 opened this issue Nov 15, 2022 · 0 comments
Open

Guidance on testing / MissingPluginException event.scanResult #134

dlewis2017 opened this issue Nov 15, 2022 · 0 comments

Comments

@dlewis2017
Copy link

dlewis2017 commented Nov 15, 2022

I'm looking for a good way to test QuickBlue within my apps functionality. Trying to run flutter test and am getting this exception. I imagine it's linked to EventChannel('quick_blue/event.scanResult'); in method_channel_quick_blue.dart

Flutter has some recommended approaches for resolving this issue but:

  1. Wrapping the plugin seems viable but passing QuickBlue as a parameter to my Bloc isn't great because it's recognized as a type and not a parameter. So this begs the questions of how I'd instantiate it in the mocked class.
  2. Mocking the platform interface seems reasonable because I think this is a federated plugin but, again, I'd have to change the implementation/the Bloc, to ingest QuickBluePlatform.instance which does not have some methods and handler setters like QuickBlue does and tells me it isn't instantiated yet.

Thoughts?

══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following MissingPluginException was thrown while activating platform stream on channel
quick_blue/event.scanResult:
MissingPluginException(No implementation found for method listen on channel
quick_blue/event.scanResult)

When the exception was thrown, this was the stack:
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:294:7)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19045.2251], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.5)
[√] Android Studio (version 2021.1)
[√] VS Code (version 1.73.1)
[√] Connected device (3 available)
[√] HTTP Host Availability

• No issues found!

Some yaml dependencies:

quick_blue:  0.5.0-dev.2
freezed_annotation: ^2.0.1
json_annotation: ^4.7.0
window_manager: ^0.2.5
# Windows
win32: ^2.6.1
# Global state
bloc: ^8.0.3
flutter_bloc: ^8.0.1
equatable: ^2.0.3
@dlewis2017 dlewis2017 changed the title MissingPluginException event.scanResult Guidance on testing / MissingPluginException event.scanResult Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant