[camera] Fix exception in registerWith (#6009)

Fixes a regression from an unintented change in behavior during the
conversion to an in-app method channel for Android and iOS. Although the
Dart code for their implementations is almost identical to the shared
method channel version, the differences in initialization paths caused
the platform versions to try to use the widget bindings before they had
been set up: The constructor for a `dartPluginClass` is called during
`registerWith`, which is before `main`, but the constructor for the
default implementation isn't called until `CameraPlatform.instance` is
called, since Dart automatically does lazy static class initializtion.

To avoid the issue without forcing bindings to be initialized early,
this makes setting up the platform channel listener lazily.

Fixes https://github.com/flutter/flutter/issues/106236
8 files changed
tree: 10e5255e06e1f9af14f869313746568de24fe562
  1. .ci/
  2. .github/
  3. .opensource/
  4. packages/
  5. script/
  6. .ci.yaml
  7. .cirrus.yml
  8. .clang-format
  9. .gitattributes
  10. .gitignore
  11. .gitmodules
  12. analysis_options.yaml
  13. AUTHORS
  14. CODEOWNERS
  15. CONTRIBUTING.md
  16. FlutterFire.md
  17. LICENSE
  18. README.md
README.md

Flutter plugins

Build Status Release Status

This repo is a companion repo to the main flutter repo. It contains the source code for Flutter first-party plugins (i.e., plugins developed by the core Flutter team). Check the packages directory for all plugins.

Flutter plugins enable access to platform-specific APIs. For more information about plugins, and how to use them, see https://flutter.dev/platform-plugins/.

These plugins are also available on pub.

Issues

Please file any issues, bugs, or feature requests in the main flutter repo.

Issues pertaining to this repository are labeled “plugin”.

Contributing

If you wish to contribute a new plugin to the Flutter ecosystem, please see the documentation for developing packages and platform channels. You can store your plugin source code in any GitHub repository (the present repo is only intended for plugins developed by the core Flutter team). Once your plugin is ready, you can publish it to the pub repository.

If you wish to contribute a change to any of the existing plugins in this repo, please review our contribution guide, and send a pull request.

Plugins

These are the available plugins in this repository.

PluginPubPointsPopularityLikesIssuesPull requests
camerapub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
espressopub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
file_selectorpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
flutter_plugin_android_lifecyclepub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
google_maps_flutterpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
google_sign_inpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
image_pickerpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
in_app_purchasepub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
ios_platform_imagespub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
local_authpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
path_providerpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
plugin_platform_interfacepub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
quick_actionspub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
shared_preferencespub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
url_launcherpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
video_playerpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label
webview_flutterpub packagepub pointspopularitylikesGitHub issues by-labelGitHub pull requests by-label