Repository: flutter
Issue: Closure serialization for web does not match expectations
Labels: a: tests,team,framework,platform-web,has reproducible steps,P3,c: tech-debt,team: skip-test,found in release: 3.12,team-web,triaged-web

(Skip Audit)

It seems that closure serialization does not work the same on the web.

Referring to this skip:
https://github.com/flutter/flutter/blob/2ce36f6199028b54db30b518012ab14afa80d15e/packages/flutter/test/foundation/diagnostics_test.dart#L1235

<details><summary>Logs</summary>

```
01:10 +102 ~10 -1: /tmp/flutter sdk/packages/flutter/test/foundation/diagnostics_test.dart: missing callback property test [E]                                                                         
  Expected: 'onClick: Closure: () => void'
    Actual: 'onClick:\n'
              '  Closure: () => void from: function onClick() {\n'
              '        }'
     Which: is different.
            Expected: onClick: Closure:  ...
              Actual: onClick:\n  Closur ...
                              ^
             Differ at offset 8
  package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 195:49      throw_
  package:test_api                                                                          expect$
  package:flutter_test/src/widget_tester.dart 348:3                                         expect$
  diagnostics_test.dart 1228:5                                                              <fn>
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 47:50                onValue
  package:stack_trace                                                                       <fn>
  package:dart-sdk/lib/async/zone.dart 1192:38                                              _rootRunUnary
  package:dart-sdk/lib/async/zone.dart 1085:19                                              runUnary
  package:dart-sdk/lib/async/future_impl.dart 141:18                                        handleValue
  package:dart-sdk/lib/async/future_impl.dart 682:44                                        handleValueCallback
  package:dart-sdk/lib/async/future_impl.dart 711:32                                        _propagateToListeners
  package:dart-sdk/lib/async/future_impl.dart 391:9                                         <fn>
  package:stack_trace                                                                       <fn>
  package:dart-sdk/lib/async/zone.dart 1184:13                                              _rootRun
  package:dart-sdk/lib/async/zone.dart 1077:19                                              run
  package:dart-sdk/lib/async/zone.dart 979:7                                                runGuarded
  package:dart-sdk/lib/async/zone.dart 1019:23                                              callback
  package:dart-sdk/lib/async/schedule_microtask.dart 43:11                                  _microtaskLoop
  package:dart-sdk/lib/async/schedule_microtask.dart 52:5                                   _startMicrotaskLoop
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 168:15               <fn>
  ===== asynchronous gap ===========================
  package:dart-sdk/lib/async/zone.dart 1109:19                                              registerUnaryCallback
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 69:19                _async
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 86:54                runBody
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 125:12               _async
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/async/zone.dart 1184:13                                              _rootRun
  package:dart-sdk/lib/async/zone.dart 1077:19                                              run
  package:dart-sdk/lib/async/zone.dart 1618:67                                              _runZoned
  package:dart-sdk/lib/async/zone.dart 1539:10                                              runZoned
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/async/zone.dart 1184:13                                              _rootRun
  package:dart-sdk/lib/async/zone.dart 1077:19                                              run
  package:dart-sdk/lib/async/zone.dart 1618:67                                              _runZoned
  package:dart-sdk/lib/async/zone.dart 1539:10                                              runZoned
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 86:54                runBody
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 125:12               _async
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 86:54                runBody
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 125:12               _async
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/async/future.dart 176:37                                             <fn>
  package:stack_trace                                                                       <fn>
  package:dart-sdk/lib/async/zone.dart 1180:38                                              _rootRun
  package:dart-sdk/lib/async/zone.dart 1077:19                                              run
  package:dart-sdk/lib/async/zone.dart 979:7                                                runGuarded
  package:dart-sdk/lib/async/zone.dart 1019:23                                              <fn>
  package:stack_trace                                                                       <fn>
  package:dart-sdk/lib/async/zone.dart 1184:13                                              _rootRun
  package:dart-sdk/lib/async/zone.dart 1077:19                                              run
  package:dart-sdk/lib/async/zone.dart 1003:23                                              <fn>
  package:dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 50:19           internalCallback
  ===== asynchronous gap ===========================
  package:dart-sdk/lib/async/zone.dart 1101:19                                              registerCallback
  package:dart-sdk/lib/async/zone.dart 1018:22                                              bindCallbackGuarded
  package:dart-sdk/lib/async/timer.dart 54:45                                               new
  package:dart-sdk/lib/async/timer.dart 91:9                                                run
  package:dart-sdk/lib/async/future.dart 174:11                                             new
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 86:54                runBody
  package:dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 125:12               _async
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/async/zone.dart 1184:13                                              _rootRun
  package:dart-sdk/lib/async/zone.dart 1077:19                                              run
  package:dart-sdk/lib/async/zone.dart 1618:67                                              _runZoned
  package:dart-sdk/lib/async/zone.dart 1539:10                                              runZoned
  package:stack_trace                                                                       <fn>
  package:dart-sdk/lib/async/zone.dart 1184:13                                              _rootRun
  package:dart-sdk/lib/async/zone.dart 1077:19                                              run
  package:dart-sdk/lib/async/zone.dart 1618:67                                              _runZoned
  package:dart-sdk/lib/async/zone.dart 1539:10                                              runZoned
  package:test_api                                                                          [_onRun]
  package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 306:14  _checkAndCall
  package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 370:10  callMethod
  package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 374:5   dsend
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/async/zone.dart 1184:13                                              _rootRun
  package:dart-sdk/lib/async/zone.dart 1077:19                                              run
  package:dart-sdk/lib/async/zone.dart 1618:67                                              _runZoned
  package:dart-sdk/lib/async/zone.dart 1539:10                                              runZoned
  package:test_api                                                                          <fn>
  package:dart-sdk/lib/async/zone.dart 1192:38                                              _rootRunUnary
  package:dart-sdk/lib/async/zone.dart 1085:19                                              runUnary
  package:dart-sdk/lib/async/zone.dart 987:7                                                runUnaryGuarded
  package:dart-sdk/lib/async/stream_impl.dart 339:11                                        [_sendData]
  package:dart-sdk/lib/async/stream_impl.dart 266:7                                         [_add]
  package:dart-sdk/lib/async/stream_controller.dart 779:19                                  [_sendData]
  package:dart-sdk/lib/async/stream_controller.dart 655:7                                   [_add]
  package:dart-sdk/lib/async/stream_controller.dart 597:5                                   add
  package:dart-sdk/lib/async/zone.dart 1196:13                                              _rootRunUnary
  package:dart-sdk/lib/async/zone.dart 1085:19                                              runUnary
  package:dart-sdk/lib/async/zone.dart 987:7                                                runUnaryGuarded
  package:dart-sdk/lib/async/stream_impl.dart 339:11                                        [_sendData]
  package:dart-sdk/lib/async/stream_impl.dart 266:7                                         [_add]
  package:dart-sdk/lib/async/stream_controller.dart 779:19                                  [_sendData]
  package:dart-sdk/lib/async/stream_controller.dart 655:7                                   [_add]
  package:dart-sdk/lib/async/stream_controller.dart 597:5                                   add
  package:dart-sdk/lib/async/stream_controller.dart 873:13                                  add
  package:stream_channel                                                                    <fn>
  package:dart-sdk/lib/async/zone.dart 1374:10                                              runUnaryGuarded
  package:dart-sdk/lib/async/stream_impl.dart 339:11                                        [_sendData]
  package:dart-sdk/lib/async/stream_impl.dart 266:7                                         [_add]
  package:dart-sdk/lib/async/stream_controller.dart 779:19                                  [_sendData]
  package:dart-sdk/lib/async/stream_controller.dart 655:7                                   [_add]
  package:dart-sdk/lib/async/stream_controller.dart 597:5                                   add
  package:dart-sdk/lib/async/zone.dart 1374:10                                              runUnaryGuarded
  package:dart-sdk/lib/async/stream_impl.dart 339:11                                        [_sendData]
  package:dart-sdk/lib/async/stream_impl.dart 266:7                                         [_add]
  package:dart-sdk/lib/async/stream_controller.dart 779:19                                  [_sendData]
  package:dart-sdk/lib/async/stream_controller.dart 655:7                                   [_add]
  package:dart-sdk/lib/async/stream_controller.dart 597:5                                   add
  package:dart-sdk/lib/async/stream_controller.dart 873:13                                  add
  package:dart-sdk/lib/async/zone.dart 1374:10                                              runUnaryGuarded
  package:dart-sdk/lib/async/stream_impl.dart 339:11                                        [_sendData]
  package:dart-sdk/lib/async/stream_impl.dart 266:7                                         [_add]
  package:dart-sdk/lib/async/stream_controller.dart 779:19                                  [_sendData]
  package:dart-sdk/lib/async/stream_controller.dart 655:7                                   [_add]
  package:dart-sdk/lib/async/stream_controller.dart 597:5                                   add
  package:dart-sdk/lib/async/zone.dart 1374:10                                              runUnaryGuarded
  package:dart-sdk/lib/async/stream_impl.dart 339:11                                        [_sendData]
  package:dart-sdk/lib/async/stream_impl.dart 266:7                                         [_add]
  package:dart-sdk/lib/async/stream_controller.dart 779:19                                  [_sendData]
  package:dart-sdk/lib/async/stream_controller.dart 655:7                                   [_add]
  package:dart-sdk/lib/async/stream_controller.dart 597:5                                   add
  package:dart-sdk/lib/async/stream_controller.dart 873:13                                  add
  package:stream_channel                                                                    add
  diagnostics_test.dart.browser_test.dart 52:17                                             <fn>
  package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 306:14  _checkAndCall
  package:dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 311:39  dcall
  package:dart-sdk/lib/html/dart2js/html_dart2js.dart 37108:58                              <fn>
```
</details>