Ad
How To Pass Array Of Strings With InvokeMethod From Native To Flutter
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?
Ad
Answer
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(){
Ad
source: stackoverflow.com
Related Questions
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View
Ad