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
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.