RxMethodChannelPlatformImpl constructor
RxMethodChannelPlatformImpl({
- required String channelName,
Implementation
RxMethodChannelPlatformImpl({required String channelName})
: _channel = MethodChannel(channelName) {
_channel.setMethodCallHandler((call) async {
if (call.method == "observableCallback") {
try {
final args = jsonDecode(call.arguments);
final callback = ObservableCallback.fromJson(args);
_observableCallbackController.sink.add(callback);
} catch (e) {
throw Exception("Error parsing observable callback arguments");
}
} else {
throw UnimplementedError(
"Method ${call.method} is not implemented on Dart side");
}
});
}