Reputation: 3142
According to this link I made an AAR
library from a Flutter module with flutter build aar
command, but after following the steps in document and successfully making and importing it in the host Android project I can't access any of my dart classes!
In the document it is mentioned how to start a Flutter activity
in host project but I just want to access my dart classes.
Does anyone know how can I do that?
Upvotes: 1
Views: 234
Reputation: 16699
It is impossible. You cannot use dart classes inside the java/kotlin or swift. While compiling flutter does not compile to java/kotlin or swift. It compiles to the bytecode of its own virtual machine - Dart VM. Here is a small FAQ about general flutter concepts. There is a way to use java/kotlin or swift native code inside a dart code though - it is called platform channels. You can pass some data and retrieve some data from the platform native code. But you can only do it from inside the flutter app.
So the solution to your problem is to inverse usage of the code you wanted to use in native platform - you need to create a flutter app that uses native code instead of creating native app that uses dart library.
Upvotes: 4