Based On this thread I want to pass array of strings as argument lik this :
Object obj = new String[] {"Hello","Bye"};
channel.invokeMethod("foo",obj, new MethodChannel.Result(){
...
);
but it shows error :
Unsupported value: [Ljava.lang.String .
How can I do that?
The StandardMessageCodec
doesn't support arrays (except of int
and byte
). For objects, it supports Java collections, like List
and Map
. Change your array of String to a List<String>
.
ArrayList<String> args = new ArrayList<>();
args.add("Hello");
args.add("Bye");
channel.invokeMethod("foo", args, new MethodChannel.Result(){
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With