I have a flutter project (plugin) that uses some native java code as well. To communicate between dart and java I use the MethodChannel.invokeMethod
. This works very nicely from dart for java and I can pull out the named arguments with call.argument("name")
in java.
The other way is, however, giving me a bit of headache as I need to pass a variable number of arguments to dart with my method call, but invokeMethod only takes "Object
" as an argument.
I have seen it work with just the single argument like a string or int, but I cannot seem to find a good way to implement it for multiple arguments.
I would have expected that there was some sort of list object type that I could pass as an argument for invokeMethod but I have not been able to find it anywhere.
Can any of you give a hint on how to best do this?