🐛 Copy the result data instead of referencing directly#113
Conversation
|
cc @littleGnAl |
|
Thanks @AlexV525, I'm no longer working for Agora. I think the new maintainer will take a look at your PR. |
For maintainers: the error will occur when an unexpected Agora exception is thrown and the native api result is an empty map. |
|
I think this is an error that could theoretically occur, but has not actually happened, right? The I would personally suggest the following fixes:
CallApiResult createNativeEventHandler(IrisMethodCall methodCall) {
...
return CallApiResult(
irisReturnCode: result.irisReturnCode,
data: {
'observerIntPtr': IrisEventHandlerHandle(eventHandlerIntPtr),
...result.data
},
rawData: result,
);
}Anyway, I think the new maintainer will make a decision about it. |
Unfortunately, this is an exception I've encountered while debugging.
It is, an immutable class does not mean it must be a constant class. But we can take another approach. |
|
cc @peilinok |
When a const map was delivered in the call result, modifying the data would be unsupported since the data is unmodifiable.
iris_method_channel_flutter/lib/src/platform/io/iris_method_channel_internal_io.dart
Line 374 in 418b5d4
The above line might throw:
Unhandled Exception: Unsupported operation: Cannot modify unmodifiable map