Why do I need this?
I'm creating a Flutter package (for android) and I want to create the MethodCallHandler's code in a separate AAR file that can be added in my plugin's code
So I'll have:
pluginNativeCode/android/MyPlugin.kt
import ir.malv.android.flutter.MySeparateMethodCallHandler
class MyFlutterPlugin: FlutterPlugin {
override fun onAttachedToEngine(...) {
// Here's the source of the problem
channel.setMethodCallHandler(MySeparateMethodCallHandler())
}
}
The MySeparateMethodCallHandler is not in the plugin/android part and it's imported as a gradle dependency
However in that library I don't have access to flutter's codes like MethodCallHandler class.
Similar behaviour in unity and react native
In react-native there is
com.facebook.react:react-native:+that can be added ascompileOnlyto get the needed react-native codes
In unity we have
unity.jarfile which contains unity native codes and can be added ascompileOnlyas well to provide engine's native APIs
What do we have in Flutter for this?
Is there a dependency that I can include as compileOnly and use it to get the needed classes and create my aar file in a separate project?