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

MissingPluginException : the plugin works but an exception is throwed #13

Closed
rxlabz opened this issue Feb 28, 2018 · 4 comments
Closed
Assignees

Comments

@rxlabz
Copy link
Contributor

rxlabz commented Feb 28, 2018

Hi,
first : thanks for sharing this project ! it's really exciting :)
I started to play and tried to use plugins, but even if the call works, I get a MissingPluginException.

Future _colorPick() async {
  final channel = new MethodChannel('flutter/colorpanel', const JSONMethodCodec());
  final res = await channel.invokeMethod('ColorPanel.Show');
}

For instance when I use this method to open the colorPicker, the picker is opened, but I see an exception log.

[ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
MissingPluginException(No implementation found for method ColorPanel.Show on channel flutter/colorpanel)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:153)
<asynchronous suspension>
#1      _MyHomePageState._colorPick (file:///Users/rxlabz/dev/labz/flutter/desktop/flutter_desktop2/example_flutter/lib/main.dart:81)
<asynchronous suspension>

Did I missed something ?

@rxlabz
Copy link
Contributor Author

rxlabz commented Feb 28, 2018

the exception seems to be caused by the return of nil from the plugins methods... 🤔

@stuartmorgan
Copy link
Collaborator

Issue #9 covers adding an example plugin, including the Dart side, to the example, to avoid people having to try to figure out the Dart side.

In this case, I think it's a plugin bug. The existing Dart code for interacting with this is using OptionalMethodChannel which means this never came up.

@stuartmorgan stuartmorgan self-assigned this Feb 28, 2018
@stuartmorgan
Copy link
Collaborator

Update on this: doing a quick fix for this is pretty easy, but in looking into it I filed issue #45 which ideally I'll do first.

It is definitely a plugin bug, which the current API makes much more likely than it should be.

stuartmorgan added a commit that referenced this issue May 31, 2018
Rework macOS plugin API

Replaces the synchronous plugin response using raw data with an
asynchronous response using a much higher-level abstraction that makes
sending non-empty responses much easier.

The API changes are based very closely on the iOS Flutter plugin API,
so that it will be familiar to Flutter plugin developers, and make code
sharing easier. This includes using that APIs naming and terminology
whenever possible.

This is an incremental change, in that some aspects of the iOS API (most
notably message channel registration and method codecs) are still not
present in this API. A future change will further align the macOS API
with iOS, but this portion makes most of the changes that would
significantly change the structure of a plugin (allowing for rich, async
responses).

This addresses the macOS portion of issue 45.
Also fixes issue #13 on macOS.
stuartmorgan added a commit that referenced this issue May 31, 2018
Replaces the synchronous plugin response using raw data with an
asynchronous response using a much higher-level abstraction that makes
sending non-empty responses much easier.

This makes the Linux plugin API consistent with the current state of
the macOS plugin API. It follows Flutter's Java plugin API response
object pattern, since without RTTI the ObjC approach of determining
response type in a single callback isn't viable.

As with the macOS rework, this is an incremental change. A future change
will further align the macOS API with mobile, but this portion makes most
of the changes that would significantly change the structure of a plugin
(allowing for rich, async responses).

This addresses issue #45 and issue #13
@stuartmorgan
Copy link
Collaborator

The plugins now return correct response objects, using the new API.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants