-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Copy the result data instead of referencing directly #113
base: main
Are you sure you want to change the base?
🐛 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 iris_method_channel_flutter/lib/src/platform/io/iris_method_channel_internal_io.dart Line 277 in 418b5d4
iris_method_channel_flutter/lib/src/platform/io/iris_method_channel_internal_io.dart Line 291 in 418b5d4
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