Declare the js context as nullable in skwasm surface callback (flutter/engine#45810)

Declaring this as non-nullable causes breakage with an incoming JS interop change from the SDK. Marking this as nullable fixes the issue.

This doesn't actually change any behavior. The breakages were in `test/ui/image_golden_test.dart`. No changes to the test are required (they did catch the issue when the dart roll happened).
This commit is contained in:
Jackson Gardner 2023-09-14 11:50:48 -07:00 committed by GitHub
parent 6211b68cff
commit 67ce410bd6
2 changed files with 3 additions and 2 deletions

View File

@ -78,7 +78,7 @@ class SkwasmSurface {
return completer.future;
}
void _callbackHandler(JSNumber callbackId, JSNumber context, JSAny jsContext) {
void _callbackHandler(JSNumber callbackId, JSNumber context, JSAny? jsContext) {
final Completer<JSAny> completer = _pendingCallbacks.remove(callbackId.toDartInt)!;
if (jsContext.isUndefinedOrNull) {
completer.complete(context);

View File

@ -39,8 +39,9 @@ mergeInto(LibraryManager.library, {
object.close();
}
associatedObjectsMap.delete(data.pointer);
return;
default:
console.warn('unrecognized skwasm message');
console.warn(`unrecognized skwasm message: ${skwasmMessage}`);
}
};
if (!threadId) {