Skip to content

[camerax] Update README with plugin overview - #3891

Merged
auto-submit[bot] merged 20 commits into
flutter:mainfrom
camsim99:camx_readme
May 9, 2023
Merged

[camerax] Update README with plugin overview#3891
auto-submit[bot] merged 20 commits into
flutter:mainfrom
camsim99:camx_readme

Conversation

@camsim99

@camsim99camsim99 commented May 3, 2023

Copy link
Copy Markdown
Contributor

Updates the README of the camera_android_camerax plugin with an overview and instructions as to how to use the plugin. Also adds CONTRIBUTING.md for further information on how to contribute to the plugin.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@camsim99
camsim99 marked this pull request as ready for review May 3, 2023 16:46

@bparrishMinesbparrishMines left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In webview_flutter, we added what lines to run to generate new apis and mocks. See: https://pub.dev/packages/webview_flutter_android#contributing. These were added as a response to feedback from external contributors.

Comment threadpackages/camera/camera_android_camerax/README.md Outdated
Comment threadpackages/camera/camera_android_camerax/README.md Outdated
Comment threadpackages/camera/camera_android_camerax/README.md Outdated
currently uses to implement `camera`. Each of these classes uses an `InstanceManager`
(implementation in `instance_manager.dart`) to manage objects that are created by
the plugin implementation that map to objects of the same type created on the native
side. This plugin uses [`pigeon`][12] to communicate with native code, so each of

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here is where you could include the location of the pigeon file as well as the exact command line to run. See: https://pub.dev/packages/webview_flutter_android#contributing

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ideally we should actually move that to a CONTRIBUTING.md; it's not relevant to plugin clients.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh, this is in the section you already suggested moving. Sorry, I wasn't looking at the full context when I replied at first.

Comment threadpackages/camera/camera_android_camerax/README.md Outdated
currently uses to implement `camera`. Each of these classes uses an `InstanceManager`
(implementation in `instance_manager.dart`) to manage objects that are created by
the plugin implementation that map to objects of the same type created on the native
side. This plugin uses [`pigeon`][12] to communicate with native code, so each of

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh, this is in the section you already suggested moving. Sorry, I wasn't looking at the full context when I replied at first.

Comment threadpackages/camera/camera_android_camerax/README.md Outdated
Comment threadpackages/camera/camera_android_camerax/CONTRIBUTING.md

@bparrishMinesbparrishMines left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with a couple nits

Comment threadpackages/camera/camera_android_camerax/CONTRIBUTING.md
Comment threadpackages/camera/camera_android_camerax/CONTRIBUTING.md Outdated
Comment threadpackages/camera/camera_android_camerax/CONTRIBUTING.md Outdated
@@ -0,0 +1,46 @@
# Contributing to camera\_android\_camerax

## Plugin structure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not a blocker but I think this should start with an overview of the architecture @bparrishMines designed. Maybe linking the design doc or if not that then a 1 paragraph summary describing the structure.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Added one!

regenerate the communication layer by running
`dart run pigeon --input pigeons/camerax_library.dart` from the plugin root.

On the native side in `android/src/main/java/io/flutter/plugins/camerax/`, you'll

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider saying java/kotlin or android. Native means enough different things to different people that we should minimize the usage when a more accurate word choice is available.

`dart run pigeon --input pigeons/camerax_library.dart` from the plugin root.

On the native side in `android/src/main/java/io/flutter/plugins/camerax/`, you'll
find the Host API and Flutter API implementations of the same classes wrapped with

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would probably be helpful to articulate what host api and Flutter api mean in this context of native (or java ;) code.

Comment threadpackages/camera/camera_android_camerax/CONTRIBUTING.md Outdated
in the native code map to objects created on the Dart side, and thus, are also
managed by an `InstanceManager` (implementation in `InstanceManager.java`).

If you need to access any Android classes to contribute to this plugin, you should

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand what this line through 30 is saying but I think it mixes architecture and instructions in a way that muddles what the author should use. If the architecture philosophy is include above then I think this can be shortened to "If CameraX or other Android classes do not have a duplicately named implementation in lib/src then follow the for more detail on how to add them.

you need are not wrapped or you need to access any methods not wrapped in a class,
you must take the additional steps to wrap them to maintain the structure of this plugin.

For more information on the approach of wrapping native libraries for plugins, please

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Having read though this I think a bunch of the information only makes sense after understanding the architecture. A plain english version should be at the top along with a link to the design document.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh and @bparrishMines to help people ask questions and spread this pattern or even just write about it you should come up with a unique name for the pattern.

Comment threadpackages/camera/camera_android_camerax/CONTRIBUTING.md
Comment threadpackages/camera/camera_android_camerax/README.md Outdated
Comment threadpackages/camera/camera_android_camerax/README.md
@@ -0,0 +1,46 @@
# Contributing to camera\_android\_camerax

## Plugin structure

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Added one!

Comment threadpackages/camera/camera_android_camerax/CONTRIBUTING.md
described above to add them.

For more information on the approach of wrapping native libraries for plugins,
please see the [design document][2] or contact [@bparrishmines][6] on any

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@bparrishMines is mentioning you like this okay with you?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't typically include references to our github accounts in the plugin. I think having https://github.com/flutter/packages/blob/main/CODEOWNERS should suffice. It also makes it easier to maintain since I will be added to all camera plugin PRs anyways.

Alternatively you could link to the ecosystem discord channel instead. Then anyone who is able to answer a question will be notified.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like both of those suggestions. In general it is a good idea not try not to encourage contacting a person. It is not great for the person or the one reaching out. (imagine someone 12h timezone offset from @bparrishMines 3 years from now)

@camsim99
camsim99 requested a review from reidbakerMay 8, 2023 17:19
@camsim99camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label May 8, 2023
@camsim99camsim99 mentioned this pull request May 9, 2023
11 tasks
@auto-submit
auto-submitBot merged commit 1f91710 into flutter:mainMay 9, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 9, 2023
auto-submitBot pushed a commit to flutter/flutter that referenced this pull request May 9, 2023
flutter/packages@4800d65...1f91710
2023-05-09 43054281+camsim99@users.noreply.github.com [camerax] Update README with plugin overview (flutter/packages#3891)
2023-05-09 jmccandless@google.com Fix nullability in docs (flutter/packages#3876)
2023-05-08 stuartmorgan@google.com [tools] Check version ranges when pathifying deps (flutter/packages#3943)
2023-05-08 stuartmorgan@google.com [quick_actions] Update minimum iOS version to 11 (flutter/packages#3946)
2023-05-08 stuartmorgan@google.com [shared_preferences] Update minimum iOS version to 11 (flutter/packages#3945)
2023-05-08 stuartmorgan@google.com [path_provider] Update minimum iOS version to 11 (flutter/packages#3944)
2023-05-08 34871572+gmackall@users.noreply.github.com Adding setup for TestInstanceManagerHostApi in zoom and exposure tests (flutter/packages#3947)
2023-05-08 engine-flutter-autoroll@skia.org Roll Flutter from 43ac23b to 4ed1c92 (16 revisions) (flutter/packages#3942)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
Updates the README of the `camera_android_camerax` plugin with an overview and instructions as to how to use the plugin. Also adds `CONTRIBUTING.md` for further information on how to contribute to the plugin.
@reidbakerreidbaker mentioned this pull request Aug 4, 2023
11 tasks
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
Updates the README of the `camera_android_camerax` plugin with an overview and instructions as to how to use the plugin. Also adds `CONTRIBUTING.md` for further information on how to contribute to the plugin.
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
Updates the README of the `camera_android_camerax` plugin with an overview and instructions as to how to use the plugin. Also adds `CONTRIBUTING.md` for further information on how to contribute to the plugin.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit Appp: camera

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@camsim99@stuartmorgan-g@reidbaker@bparrishMines