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

Document ffiPlugin pubspec.yaml key, and its implications on existing plugins that use FFI #108974

Open
Piero512 opened this issue Aug 4, 2022 · 4 comments
Labels
a: plugins Support for writing, building, and running plugin packages d: api docs Issues with https://api.flutter.dev/ P2 Important issues not at the top of the work list team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team

Comments

@Piero512
Copy link

Piero512 commented Aug 4, 2022

Hello!

I would like the documentation to be able to answer this following questions.

  • What is this new ffiPlugin key in the pubspec.yaml and what does it do?
  • Plugins using FFI existed before this pubspec.yaml key was introduced, so what changes under the hood?
  • Can we keep the unused method channel so that our plugin keeps building on older versions of flutter?
  • when was that key in the pubspec.yaml introduced?

Also, for extra consideration, can you maybe reply this questions (they're not completely required)

  • Will you use it for PANA?
  • Do you tree shake the native implementation if the dart library is never used?
  • Do you link statically and reflect on the FFI annotations to tell the linker to drop unused references?
@dcharkes
Copy link
Contributor

dcharkes commented Aug 4, 2022

Hello!

Hi!

I would like the documentation to be able to answer this following questions.

Where in the documentation would you like these questions answered?

  • What is this new ffiPlugin key in the pubspec.yaml and what does it do?

It ensures native libraries are build and bundles (similar to non-FFI plugins) but does not include method channel boilerplate.

  • Plugins using FFI existed before this pubspec.yaml key was introduced, so what changes under the hood?

These plugins included method channel boilerplate that would make the build fail if deleted.

Moreover, users had to figure out how to build/bundle native code for each target platform manually.

Use flutter create --template=plugin_ffi --platfrom=... to get an FFI plugin that has some sample C code for which the building and bundling works out of the box.

  • Can we keep the unused method channel so that our plugin keeps building on older versions of flutter?

Yes, you can keep using --template plugin and plugin: instead of ffiPlugin:. The bundling logic for native libraries is identical. The --template plugin does not include sample C code, so you might want to copy that and the buildfiles over from --template plugin_ffi.

  • when was that key in the pubspec.yaml introduced?

Also, for extra consideration, can you maybe reply this questions (they're not completely required)

  • Will you use it for PANA?

cc @jonasfj

  • Do you tree shake the native implementation if the dart library is never used?

This is work in progress.

  • Do you link statically and reflect on the FFI annotations to tell the linker to drop unused references?

This is work in progress with @FfiNative annotations.

@Piero512
Copy link
Author

Piero512 commented Aug 4, 2022

Woah, that was a speedy response, thank you!.

Honestly, now with those questions answered, I would think that maybe a slight paragraph with the changes for those "unofficial" plugins would have helped it going a long way. Something the likes of

we know that developers have coerced the flutter build system to bundle native code only to use it through dart:ffi and you don't need to migrate your code to the new ffiplugins just yet. You can now drop the unused method channel, or if you're still targeting older versions of flutter, keep it.

@dcharkes
Copy link
Contributor

dcharkes commented Aug 4, 2022

cc @RedBrogdon

@Piero512 Piero512 changed the title Document ffiPlugin pubspec.yaml key, and its implications on FFI plugins Document ffiPlugin pubspec.yaml key, and its implications on existing plugins that use FFI Aug 4, 2022
@stuartmorgan
Copy link
Contributor

stuartmorgan commented Aug 4, 2022

Where in the documentation would you like these questions answered?

https://docs.flutter.dev/development/packages-and-plugins/developing-packages would be the best place to document the new key; in a section similar to the recently-added https://docs.flutter.dev/development/packages-and-plugins/developing-packages#dart-platform-implementations

(From a docs standpoint, the answer to the question of when it was introduced is "3.0".)

@stuartmorgan stuartmorgan added plugin P2 Important issues not at the top of the work list labels Aug 4, 2022
dcharkes added a commit to flutter/website that referenced this issue Aug 5, 2022
Adds documentation from the questions answered in:

* flutter/flutter#108974
sfshaza2 pushed a commit to flutter/website that referenced this issue Aug 17, 2022
* Document when to use pluginFfi vs plugin

Adds documentation from the questions answered in:

* flutter/flutter#108974

* clarify sentence
khanhnwin added a commit to flutter/website that referenced this issue Aug 30, 2022
* update build.yml and restore PR template

* Document when to use pluginFfi vs plugin (#7428)

* Document when to use pluginFfi vs plugin

Adds documentation from the questions answered in:

* flutter/flutter#108974

* clarify sentence

* Update iOS minimum version documentation to 11.0 (#62)

* Bump github/codeql-action from 2.1.18 to 2.1.19 (#63)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.18 to 2.1.19.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@2ca79b6...f5d217b)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Windows] Document how to set exe's version info (#60)

* Tweak

* Tweak

* Add migration guide

* Polish

* Update src/deployment/windows.md

Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>

* Fix examples for flutter beta (#64)

* dart fix add_languages examples

* fix examples/layout/constraints

* fix examples/cookbook/effects/stagger_menu_animation

* fix examples/ui/advanced/actions_and_shortcut

* refresh excerpts

* update build.yml setting beta experimental = false

* Bump github/codeql-action from 2.1.19 to 2.1.20 (#65)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.19 to 2.1.20.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@f5d217b...7fee4ca)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Khanh Nguyen <khanhnwin@gmail.com>

* Bump firebase-tools from 11.7.0 to 11.8.0 (#66)

Bumps [firebase-tools](https://github.com/firebase/firebase-tools) from 11.7.0 to 11.8.0.
- [Release notes](https://github.com/firebase/firebase-tools/releases)
- [Commits](firebase/firebase-tools@v11.7.0...v11.8.0)

---
updated-dependencies:
- dependency-name: firebase-tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Khanh Nguyen <khanhnwin@gmail.com>

* Add instructions for enabling Developer Mode on iOS 16 (#67)

* Add instructions for enabling Developer Mode on iOS 16

* Review edits

* Bump pigeon in /examples/development/platform_integration (#69)

Bumps [pigeon](https://github.com/flutter/packages/tree/main/packages) from 3.2.9 to 4.0.0.
- [Release notes](https://github.com/flutter/packages/releases)
- [Commits](https://github.com/flutter/packages/commits/pigeon-v4.0.0/packages)

---
updated-dependencies:
- dependency-name: pigeon
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix broken PR link at bottom of splashScreenView breaking change (#68)

* Update breaking changes  (#70)

* links flutter 3.0 breaking changes to master api docs

* updated breaking changes

* updated breaking changes

* Bump github/codeql-action from 2.1.20 to 2.1.21 (#74)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.20 to 2.1.21.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@7fee4ca...c7f292e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Adding warning about named routes (#73)

* stashing

* Adding notes warning about named routes.

* Reverting to previous whats-new file

* Update error docs to use PlatformDispatcher instead of Zones (#71)

* Update error docs to use PlatformDispatcher instead of Zones

* refresh code excerpts

* tweak example code

* Remove random apostrophe

Co-authored-by: Khanh Nguyen <khanhnwin@gmail.com>

* Update navigation and routing documentation (#72)

* Update navigation and routing documentation

* Update src/development/ui/navigation/index.md

* Update src/development/ui/navigation/index.md

* Update src/development/ui/navigation/index.md

* Update src/development/ui/navigation/index.md

* Update src/development/ui/navigation/index.md

* Update WillPopScope note

* Apply suggestions from code review

Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>

* Update src/development/ui/navigation/index.md

Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Khanh Nguyen <khanhnwin@gmail.com>

* update release notes (#75)

* update release notes

* Update src/development/tools/sdk/release-notes/release-notes-3.3.0.md

Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>

* Update URL Strategies page (#76)

* Add what's new section for 3.3 (#77)

* stashing

* Updating the what's new page for 3.3

* Tweaking, as per feedback

* Adding release notes to index file (#78)

* Adding release notes to index file

* Update index.md

Co-authored-by: Khanh Nguyen <khanhnwin@gmail.com>

* Tweaking some things... (#79)

* Tweaking some things...

* Update whats-new.md

Co-authored-by: Khanh Nguyen <khanhnwin@gmail.com>

* revert build.yml for public repo

* fix some links

* fix PlatformDispatcher link anchor

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Daco Harkes <dacoharkes@google.com>
Co-authored-by: Jenn Magder <magder@google.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
Co-authored-by: Shams Zakhour (ignore Sfshaza) <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Shamira <23406866+MiraMarshall@users.noreply.github.com>
Co-authored-by: Dan Field <dnfield@google.com>
Co-authored-by: John Ryan <ryjohn@google.com>
Co-authored-by: Kevin Chisholm <kevinjchisholm@google.com>
@stuartmorgan stuartmorgan added a: plugins Support for writing, building, and running plugin packages and removed plugin labels Mar 6, 2023
@flutter-triage-bot flutter-triage-bot bot added the d: api docs Issues with https://api.flutter.dev/ label Jul 5, 2023
@stuartmorgan stuartmorgan added team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: plugins Support for writing, building, and running plugin packages d: api docs Issues with https://api.flutter.dev/ P2 Important issues not at the top of the work list team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team
Projects
None yet
Development

No branches or pull requests

4 participants