Repository: flutter
Issue: [engine] Dart VM exception not using `.log_message_callback`
Labels: engine,e: embedder,P2,team-engine,triaged-engine

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

Using embedder API in FlutterProjectArgs.log_message_callback when Dart VM hits exception, it prints to console instead of to log_message_callback.

### Expected results

The expected results would be that Dart VM std::cout or std::cerr is redirected using log_message_callback.

### Actual results

Dart VM exception writes to console output bypassing message handler.

### Code sample

<details><summary>Code sample</summary>

```C++
          .log_message_callback =
              [](const char* tag, const char* message, void* user_data) {
#if defined(ENABLE_DART_VM_LOGGING)
                (void)tag;
                auto engine = reinterpret_cast<Engine*>(user_data);
                engine->m_vm_logger->info(message);
#endif
                (void)tag;
                (void)message;
                (void)user_data;
              },
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details><summary>Logs</summary>

```console
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: UnimplementedError: init() has not been implemented.
#0      VideoPlayerPlatform.init (package:video_player_platform_interface/video_player_platform_interface.dart:43:5)
#1      _videoPlayerPlatform (package:video_player/video_player.dart:28:21)
#2      VideoPlayerController.initialize (package:video_player/video_player.dart:422:13)
#3      _BumbleBeeRemoteVideoState.initState (package:video_player_example/main.dart:231:17)
#4      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5101:55)
#5      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#6      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#7      Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#8      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4993:16)
#9      Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5)
#10     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4950:5)
#11     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#12     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#13     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#14     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6377:14)
#15     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#16     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#17     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6377:14)
#18     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#19     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#20     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4993:16)
#21     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5133:11)
#22     Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5)
#23     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4950:5)
#24     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5124:11)
#25     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#26     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#27     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#28     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4993:16)
#29     Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5)
#30     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4950:5)
#31     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#32     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#33     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#34     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4993:16)
#35     Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5)
#36     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4950:5)
#37     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#38     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#39     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#40     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4993:16)
#41     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5133:11)
#42     Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5)
#43     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4950:5)
#44     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5124:11)
#45     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#46     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#47     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#48     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4993:16)
#49     Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5)
#50     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4950:5)
#51     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4944:5)
#52     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3953:16)
#53     Element.updateChild (package:flutter/src/widgets/framework.dart:3682:18)
#54     SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1451:37)
#55     SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1436:20)
#56     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2682:19)
#57     SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1428:12)
#58     RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:353:23)
#59     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:2300:59)
#60     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:1056:15)
#61     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2300:14)
#62     RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:342:5)
#63     RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:428:5)
#64     RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:205:12)
#65     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#66     RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:149:12)
#67     _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver_fill.dart:166:11)
#68     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#69     RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:550:13)
#70     RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1634:12)
#71     RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1541:20)
#72     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#73     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#74     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#75     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#76     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#77     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#78     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#79     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#80     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#81     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#82     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#83     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#84     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#85     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#86     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#87     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#88     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#89     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#90     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#91     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#92     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#93     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1080:7)
#94     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
#95     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:410:14)
#96     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#97     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#98     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#99     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#100    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#101    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#102    _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1467:11)
#103    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#104    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#105    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#106    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#107    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#108    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#109    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#110    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#111    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#112    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#113    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#114    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#115    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#116    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#117    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#118    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#119    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#120    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#121    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#122    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#123    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#124    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#125    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#126    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#127    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#128    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#129    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#130    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#131    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#132    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#133    RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3815:13)
#134    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#135    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#136    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#137    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#138    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#139    _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:856:15)
#140    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#141    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#142    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#143    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#144    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#145    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#146    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#147    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#148    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#149    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#150    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#151    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#152    RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:552:11)
#153    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#154    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#155    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#156    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#157    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#158    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#159    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#160    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#161    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#162    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#163    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#164    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#165    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#166    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#167    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#168    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#169    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#170    RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#171    RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#172    RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#173    RenderView.performLayout (package:flutter/src/rendering/view.dart:175:14)
#174    RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2027:7)
#175    PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1020:18)
#176    RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:516:19)
#177    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:865:13)
#178    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:381:5)
#179    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1289:15)
#180    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1218:9)
#181    SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:942:7)
#182    Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#183    _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#184    _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#185    _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[!] Flutter (Channel unknown, 3.10.5, on Fedora Linux 37 (Workstation Edition) 6.3.8-100.fc37.x86_64, locale en_US.UTF-8)
    ! Flutter version 3.10.5 on channel unknown at /mnt/raid10/workspace-automation/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    • Framework revision 796c8ef792 (4 weeks ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 15.0.7 (Fedora 15.0.7-2.fc37)
    • cmake version 3.26.4
    • ninja version 1.10.2
    • pkg-config version 1.8.0

[✓] VS Code (version 1.80.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.68.0

[✓] Connected device (2 available)
    • Linux (desktop)              • linux        • linux-x64 • Fedora Linux 37 (Workstation Edition) 6.3.8-100.fc37.x86_64
    • Toyota flutter-auto (mobile) • desktop-auto • linux-x64 • flutter-auto x86_64

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>