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

flutter_web_plugins cleanup and documentation #67164

Merged
merged 1 commit into from Oct 6, 2020

Conversation

Hixie
Copy link
Contributor

@Hixie Hixie commented Oct 2, 2020

  • Provide library documentation, so that there is introductory material on https://master-api.flutter.dev/flutter/package-flutter_web_plugins_flutter_web_plugins/package-flutter_web_plugins_flutter_web_plugins-library.html

  • Describe the API exposed by PluginEventChannel over the message channel.

  • Deprecate the controller setter on PluginEventChannel in favour of a method. Having only a setter violates the Dart style guide.

  • Avoid creating the _EventChannelHandler when it is immediately discarded.

  • Assert that the arguments to listen and cancel are null, and remove corresponding TODOs.

  • Apply the Flutter formatting style more widely (especially to avoid left margin confusion where less indented code is nested deeper in the AST).

  • Add additional detail to various parts of the docs.

  • Use the ```dart style for API doc sample code, to get analysis.

  • Improve the precision of some error messages.

  • Remove the use of ChannelBuffers, which as far as we can tell doesn't really make sense here (they are for engine->framework buffering, so using it here introduces a bunch of weird race conditions that could send messages in unexpected directions). I think it hasn't caused any problems yet because it's pretty rare to unsubscribe from channels which is when most of teh issues would manifest.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@Hixie Hixie marked this pull request as draft October 2, 2020 21:14
@Hixie Hixie force-pushed the flutter_web_plugins branch 5 times, most recently from 78c8018 to 715e263 Compare October 6, 2020 00:03
@Hixie Hixie marked this pull request as ready for review October 6, 2020 19:11
Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -25,6 +30,8 @@ class PluginRegistry {
/// Registers this plugin handler with the engine, so that unrecognized
/// platform messages are forwarded to the registry, where they can be
/// correctly dispatched to one of the registered plugins.
///
/// Only one [PluginRegistry] can be so registered at a time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: delete 'so'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated docs with more information while i was at it

@Hixie
Copy link
Contributor Author

Hixie commented Oct 6, 2020

Thanks for the review! Added label so this will land on green.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if LGT @hterkelsen

/// the [controller].
///
/// Events added to the [controller] when the framework is not
/// subscribed are silently dropped on the floor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if "drop on the floor" is a commonly understood idiom. How about "ignored"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

went with "discarded"

@Deprecated(
'Replace calls to the "controller" setter with calls to the "setController" method. '
'This feature was deprecated after v1.23.0-7.0.pre.'
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to clean this up before stable release. How widespread is the usage of this setter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Piinks is working on a deprecation policy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make sure to send you the proposal, it will include what usage data I've been able to collect and some guidelines for cleaning up old code. <=1 week out from publishing :)

* Provide library documentation, so that there is introductory material on https://master-api.flutter.dev/flutter/package-flutter_web_plugins_flutter_web_plugins/package-flutter_web_plugins_flutter_web_plugins-library.html

* Describe the API exposed by PluginEventChannel over the message channel.

* Deprecate the `controller` setter on PluginEventChannel in favour of a method. Having only a setter violates the Dart style guide.

* Avoid creating the _EventChannelHandler when it is immediately discarded.

* Assert that the arguments to `listen` and `cancel` are null, and remove corresponding TODOs.

* Apply the Flutter formatting style more widely (especially to avoid left margin confusion where less indented code is nested deeper in the AST).

* Add additional detail to various parts of the docs.

* Use the \`\`\`dart style for API doc sample code, to get analysis.

* Improve the precision of some error messages.

* Remove the use of ChannelBuffers, which as far as we can tell doesn't really make sense here (they are for engine->framework buffering, so using it here introduces a bunch of weird race conditions that could send messages in unexpected directions). I think it hasn't caused any problems yet because it's pretty rare to unsubscribe from channels which is when most of teh issues would manifest.
@fluttergithubbot fluttergithubbot merged commit 8d923bf into flutter:master Oct 6, 2020
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

Successfully merging this pull request may close these issues.

None yet

6 participants