transfer GoogleSignInAccout to kotlin side from flutter below flutter method chanel

32 Views Asked by At

I want to pass the 'GoogleSignInAccount' object to kotlin via the invokeMethod - flutter method chanel. On the kotlin side, count and use this object. But when transmitting, I get the error 'ArgumentError (Invalid argument: Instance of 'GoogleSignInAccount')'
How can I transfer and is it possible to transfer objects at all ? error what i recive

the error occurs in this line. I was looking for an example of transferring objects, but I didn't find them. I tried to write to map, and pass an array. but the error is the same

final  decoded = json.decode(await platform.invokeMethod('readFitData', googleUser));
1

There are 1 best solutions below

3
Rishabh Agrawal On

you need to stringify your payload as method channel only accepts certain native data type alternatively you can use https://pub.dev/packages/pigeon

enter image description here

More details can be found here https://docs.flutter.dev/platform-integration/platform-channels?tab=type-mappings-kotlin-tab