Repository: flutter
Issue: Debug mode too persmissive
Labels: a: error message,team-framework

### 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

Hello,

If we want to execute the code below in debug, with an error (Expanded sub-child inside row), there will be no error like red rectangle, and VSCode (with checked Uncaught Exceptions) will not catch an error.

```
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  Widget _wrapWidgetWithGesture(Widget child) {
    return GestureDetector(
      onTap: () {
        print("world");
      },
      child: child,
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        home: Scaffold(
          body: Center(
            child: Row(
              children: [
                const Expanded(child: Text('Hello')),
                _wrapWidgetWithGesture(const Expanded(child: Text('World'))),
              ],
            ),
          ),
        ));
  }
}
```

With .vscode/launch.json

```
{
    "version": "0.2.0",
    "configurations": [
        {
            "program": "lib/main.dart",
            "name": "Debug",
            "request": "launch",
            "type": "dart"
        },
        {
            "program": "lib/main.dart",
            "args": ["--release"],
            "name": "Release",
            "request": "launch",
            "type": "dart"
        },
    ]
}
```

=>

![Screenshot_20230919_143000](https://github.com/flutter/flutter/assets/58068925/6b2edb99-3cd8-427f-8cf2-4a670d4b25e8)


However on logs, error appears 
```
#3      RenderObjectElement.mount
framework.dart:6154
#4      MultiChildRenderObjectElement.mount
framework.dart:6576
...     Normal element mounting (33 frames)
#37     Element.inflateWidget
framework.dart:4182
#38     MultiChildRenderObjectElement.inflateWidget
framework.dart:6569
#39     MultiChildRenderObjectElement.mount
framework.dart:6581
...     Normal element mounting (28 frames)
#67     Element.inflateWidget
framework.dart:4182
#68     MultiChildRenderObjectElement.inflateWidget
framework.dart:6569
#69     MultiChildRenderObjectElement.mount
framework.dart:6581
...     Normal element mounting (128 frames)
#197    Element.inflateWidget
framework.dart:4182
#198    MultiChildRenderObjectElement.inflateWidget
framework.dart:6569
#199    MultiChildRenderObjectElement.mount
framework.dart:6581
...     Normal element mounting (178 frames)
#377    Element.inflateWidget
framework.dart:4182
#378    MultiChildRenderObjectElement.inflateWidget
framework.dart:6569
#379    MultiChildRenderObjectElement.mount
framework.dart:6581
...     Normal element mounting (492 frames)
#871    Element.inflateWidget
framework.dart:4182
#872    Element.updateChild
framework.dart:3707
#873    RenderObjectToWidgetElement._rebuild
binding.dart:1253
#874    RenderObjectToWidgetElement.mount
binding.dart:1222
#875    RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
binding.dart:1169
#876    BuildOwner.buildScope
framework.dart:2719
#877    RenderObjectToWidgetAdapter.attachToRenderTree
binding.dart:1168
#878    WidgetsBinding.attachRootWidget
binding.dart:1001
#879    WidgetsBinding.scheduleAttachRootWidget.<anonymous closure>
binding.dart:981
#883    _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
(elided 3 frames from class _Timer and dart:async-patch)
════════════════════════════════════════════════════════════════════════════════
```

I think flutter engine should raise a breakpoint error on code editor, or display red rectangle, because if the developer does not look at the logs, it seems every thing is fine, but on release the display is a big grey screen (equivalent to red on debug for other issues) : 

=>

![Screenshot_20230921_162539](https://github.com/flutter/flutter/assets/58068925/f65c90ab-b8c2-4ffa-b13c-206620b0ed8b)


Another example with such a problem, here the error is SingleChildScrollView with Expanded child
```
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
        title: 'Flutter Demo',
        home: Scaffold(
          body: Center(
            child: SingleChildScrollView(
              child: Expanded(
                child: Text('hello'),
              ),
            ),
          ),
        ));
  }
}
```


It seems debug mode is now more permissive, and is able to display even when crashes on release. It seems to be a little too permissive. I think it was not the case before.


### Expected results

-

### Actual results

-

### Code sample

<details><summary>Code sample</summary>

```dart
[Paste your code here]
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.13.4, on macOS 13.4.1 22F82 darwin-arm64, locale fr-FR)
    • Flutter version 3.13.4 on channel stable at /Users/dleurs/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 367f9ea16b (il y a 8 jours), 2023-09-12 23:27:53 -0500
    • Engine revision 9064459a8b
    • Dart version 3.1.2
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/dleurs/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.82.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.72.0

[✓] Connected device (4 available)
    • SM A536B (mobile)          • RZCW7177BFH                          • android-arm64  • Android 13 (API 33)
    • iPhone 14 Pro Max (mobile) • F75B6921-BEB2-4434-A645-700343528CD5 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 13.4.1 22F82 darwin-arm64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 117.0.5938.88

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>