0

I develop the flutter package and in this package one of class get function argument. When I use this package in another flutter app, I can send function as prop to this package .

Now I just want to learn if I use the flutter module and build the aar , how can I send function as prop in native android ?

Thanks

1 Answers1

0

This is not possible because you can send only serializable types

By default, AIDL supports the following data types:

  • All primitive types in the Java programming language (such as int, long, char, boolean, and so on)
  • Arrays of primitive types such as int[]
  • String
  • CharSequence
  • List
    All elements in the List must be one of the supported data types in this list or one of the other AIDL-generated interfaces or parcelables you've declared. A List may optionally be used as a parameterized type class (for example, List). The actual concrete class that the other side receives is always an ArrayList, although the method is generated to use the List interface.
  • Map .
    All elements in the Map must be one of the supported data types in this list or one of the other AIDL-generated interfaces or parcelables you've declared. Parameterized type maps, (such as those of the form Map<String,Integer>) are not supported. The actual concrete class that the other side receives is always a HashMap, although the method is generated to use the Map interface. Consider using a Bundle as an alternative to Map.

For more detailed information you can refer to the official AIDL documentation

powerman23rus
  • 1,297
  • 1
  • 9
  • 17
  • Thanks for your reply . Actually this news is bad for me . But I wonder thar , how is it possible in flutter ? Because end of the build flutter will genarate native android app. So it should be way to send function as prop . I confused – Umut Bayğut Nov 30 '22 at 20:13
  • For doing such thing you should create an Callback interface through AIDL and receive an events through binding service. Start your invistigation with AIDL usage and Multiprocess communication in android. If I answered on your question is possible or not, pls, accept my answer – powerman23rus Dec 01 '22 at 10:06