1

I'm trying to create a Facebook login plugin for Flutter and already got the native code running. There is one thing I don't get though. Where do the dependencies, uses permissions and meta data go? I guess the dependencies and permissions could be added to the plugin's android folder. But the meta data needs a key that only the user can provide. So I can not put it in the android folder of my plugin, only in an android folder in projects using the plugin. But I need the meta data to make the plugin work. So I'm kinda stuck atm. Any one who has experience with this?

1 Answer 1

1

Dependencies can be added in the build.gradle and podspec of the plugin. Though if it depends on a non-standard Maven or CocoaPods repo, users will need to specify that in their project.

Permissions are added by the user if needed. Same with configuration files. Use the README of the plugin to explain what needs to be done.

If the configuration info is the same across iOS and Android (API keys etc), passing it from Dart to native is a good practice to avoid duplication. If the configuration info is different for each platform, having it be read out of a file by the plugin (or specified in the AppDelegate/Activity) allows the Dart to be agnostic to which platform it's on.

Check out the google_sign_in plugin for inspiration.

Sign up to request clarification or add additional context in comments.

3 Comments

Still a bit confused on this. Perhaps I'm mssing something. Will the plugin and user project work as 2 seperate things? And are AndroidManifest.xml and strings.xml merged in the sense that the plugin is aware of those files in the main project and can use that data?
You can read data out of the user's AndroidManifest.xml or strings.xml in the plugin if you want. stackoverflow.com/questions/10311890/… stackoverflow.com/questions/6583843/…
I'm not really an android guy. But to simplify the question a bit more: if I place some meta data in a project in androidmanifest, will the plugin be able to get to that data and use it. So i.e. an unique app key in androidmanifest in the project will be recognized and usable for the plugin?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.