handleMessage method
Implementation
@override
Future<ReturnParams> handleMessage(CallParams params) async {
try {
switch (params.callType) {
case CallType.plainApiCall:
return _handlePlainApiCall(params);
case CallType.varGetter:
return _handleVarGetter(params);
case CallType.instanceMethodInvoke:
return _handleInstanceMethodInvoke(params);
case CallType.instancePropertyGet:
return _handleInstancePropertyGet(params);
case CallType.instancePropertySet:
return _handleInstancePropertySet(params);
case CallType.instanceEventListenerAdd:
return _handleInstanceEventAdd(params);
case CallType.instanceEventListenerRemove:
return _handleInstanceEventRemove(params);
case CallType.instanceEventEmit:
return _handleInstanceEventEmit(params);
case CallType.callbackEmit:
return _handleCallbackEmit(params);
case CallType.destroyInstance:
return _handleDestroyInstance(params);
default:
throw Exception('Unknown call type: ${params.callType}');
}
} catch (e) {
logger.error('[consumer] Handler message failed:', [e]);
return ReturnParams(
status: ReturnStatus.failed,
msg: {'error': e.toString()},
);
}
}