I'm playing with PlatformChannel and MethodChannel in Flutter. Doing some basic operations... working on a opencv porting for flutter... but i can't figure out how to solve this!
There are no problems invoking simple methods, that returns objects of basic Types, like this:
Android:
@Override
public void onMethodCall(final MethodCall call, final Result result) {
switch (call.method) {
case "getVersionString":
result.success(org.opencv.core.Core.getVersionString());
break;
default:
result.notImplemented();
}
}
Dart:
Future<String> get versionString async {
return await _channel.invokeMethod('getVersionString') as String;
}
But what if i have some custom object? Something like:
Android:
@Override
public void onMethodCall(final MethodCall call, final Result result) {
switch (call.method) {
case "getVersionString":
result.success(org.opencv.core.Core.getVersionString());
break;
case "Scalar":
result.success(org.opencv.core.Core.Scalar());
break;
default:
result.notImplemented();
}
}
}
Dart:
class Scalar {
static const MethodChannel _channel = MethodChannel('flutter_opencv');
// WHAT TO DO HERE??????
}
How to implement the Scalar dart class? I need to rewrite the class starting from original sources or what?
Thanks for the attenction.