See also: Flutter's code of conduct
https://github.com/flutter/plugins
into your own GitHub account. If you already have a fork, and are now installing a development environment on a new machine, make sure you‘ve updated your fork so that you don’t use stale configuration options from long ago.git clone git@github.com:<your_name_here>/plugins.git
cd plugins
git remote add upstream git@github.com:flutter/plugins.git
(So that you fetch from the master repository, not your clone, when running git fetch
et al.)To run an example with a prebuilt binary from the cloud, switch to that example's directory, run pub get
to make sure its dependencies have been downloaded, and use flutter run
. Make sure you have a device connected over USB and debugging enabled on that device.
cd packages/battery/example
flutter run
Flutter plugins have both unit tests of their Dart API and integration tests that run on a virtual or actual device.
To run the unit tests:
flutter test test/<name_of_plugin>_test.dart
To run the integration tests using Flutter driver:
cd example flutter drive test/<name_of_plugin>.dart
To run integration tests as instrumentation tests on a local Android device:
cd example (cd android && ./gradlew -Ptarget=$(pwd)/../test_live/<name_of_plugin>_test.dart connectedAndroidTest)
We gladly accept contributions via GitHub pull requests.
Please peruse our style guide and design principles before working on anything non-trivial. These guidelines are intended to keep the code consistent and avoid common pitfalls.
To start working on a patch:
git fetch upstream
git checkout upstream/master -b <name_of_your_branch>
pub global activate flutter_plugin_tools pub global run flutter_plugin_tools format --plugins plugin_name pub global run flutter_plugin_tools analyze --plugins plugin_name pub global run flutter_plugin_tools test --plugins plugin_name
git commit -a -m "<your informative commit message>"
git push origin <name_of_your_branch>
To send us a pull request:
git pull-request
(if you are using Hub) or go to https://github.com/flutter/plugins
and click the “Compare & pull request” buttonPlease make sure all your checkins have detailed commit messages explaining the patch.
Plugins tests are run automatically on contributions using Cirrus CI. However, due to cost constraints, pull requests from non-committers may not run all the tests automatically.
The plugins team prefers that unit tests are written using setMockMethodCallHandler
rather than using mockito to mock out MethodChannel
. For a list of the plugins that are still using the mockito testing style and need to be converted, see issue 34284. If you are contributing tests to an existing plugin that uses mockito MethodChannel
, consider converting them to use setMockMethodCallHandler
instead.
Once you've gotten an LGTM from a project maintainer and once your PR has received the green light from all our automated testing, wait for one the package maintainers to merge the pull request and pub submit
any affected packages.
You must complete the Contributor License Agreement. You can do this online, and it only takes a minute. If you‘ve never submitted code before, you must add your (or your organization’s) name and contact info to the AUTHORS file.
Reviewing PRs often requires a non trivial amount of time. We prioritize issues, not PRs, so that we use our maintainers' time in the most impactful way. Issues pertaining to this repository are managed in the flutter/flutter issue tracker and are labeled with “plugin”. Non trivial PRs should have an associated issue that will be used for prioritization. See the prioritization section in the Flutter wiki to understand how issues are prioritized.
Newly opened PRs first go through initial triage which results in one of: