Skip to content
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

Calling MultiChildLayoutDelegate.hasChild from MultiChildLayoutDelegate.getSize throws an exception because _idToChild is null #115898

Closed
crazy-rodney opened this issue Nov 23, 2022 · 3 comments · Fixed by #126433
Assignees
Labels
a: layout SystemChrome and Framework's Layout Issues c: crash Stack traces logged to the console d: api docs Issues with https://api.flutter.dev/ found in release: 3.3 Found to occur in 3.3 found in release: 3.6 Found to occur in 3.6 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version

Comments

@crazy-rodney
Copy link

crazy-rodney commented Nov 23, 2022

Steps to Reproduce

  1. Execute flutter run on the code sample
  2. Exception is thrown

Expected results: Calling hasChild in getSize returns normally.

Actual results: Calling hasChild in getSize throws an exception.

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomMultiChildLayout(
        delegate: _MultiChildLayoutDelegate(),
        children: [
          LayoutId(
            id: 0,
            child: const SizedBox(
              width: 50,
              height: 50,
            ),
          ),
          LayoutId(
            id: 1,
            child: const SizedBox(
              width: 50,
              height: 50,
            ),
          ),
          LayoutId(
            id: 2,
            child: const SizedBox(
              width: 50,
              height: 50,
            ),
          )
        ],
      ),
    );
  }
}

class _MultiChildLayoutDelegate extends MultiChildLayoutDelegate {
  _MultiChildLayoutDelegate();

  @override
  Size getSize(BoxConstraints constraints) {
    hasChild(0);
    return Size(constraints.maxWidth, constraints.maxHeight);
  }

  @override
  void performLayout(Size size) {}

  @override
  bool shouldRelayout(covariant MultiChildLayoutDelegate oldDelegate) {
    return true;
  }
}
Logs
           ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
           The following _CastError was thrown during performLayout():
           Null check operator used on a null value

           The relevant error-causing widget was:
             CustomMultiChildLayout
             CustomMultiChildLayout:file:///Users/max/AndroidStudioProjects/layout_bug_example/lib/main.dart:28:13

           When the exception was thrown, this was the stack:
           #0      MultiChildLayoutDelegate.hasChild (package:flutter/src/rendering/custom_layout.dart:133:46)
           #1      _MultiChildLayoutDelegate.getSize (package:layout_bug_example/main.dart:63:5)
           #2      RenderCustomMultiChildLayoutBox._getSize (package:flutter/src/rendering/custom_layout.dart:359:44)
           #3      RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:409:12)
           #4      RenderObject.layout (package:flutter/src/rendering/object.dart:2135:7)
           #5      RenderBox.layout (package:flutter/src/rendering/box.dart:2418:11)
           #6      MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
           #7      _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1055:7)
           #8      MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
           #9      RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:410:14)
           #10     RenderObject.layout (package:flutter/src/rendering/object.dart:2135:7)
.....
       The following RenderObject was being processed when the exception was fired: RenderCustomMultiChildLayoutBox#21a29 relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
             creator: CustomMultiChildLayout ← KeyedSubtree-[GlobalKey#19ad8] ← _BodyBuilder ← MediaQuery ←
               LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← _ActionsMarker ← Actions ←
               AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#ce20a ink
               renderer] ← ⋯
             parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body (can use size)
             constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=843.4)
             size: MISSING
           This RenderObject had the following descendants (showing up to depth 5):
               child 1: RenderConstrainedBox#b765d NEEDS-LAYOUT NEEDS-PAINT
               child 2: RenderConstrainedBox#938bd NEEDS-LAYOUT NEEDS-PAINT
               child 3: RenderConstrainedBox#93540 NEEDS-LAYOUT NEEDS-PAINT
           ════════════════════════════════════════════════════════════════════════════════════════════════════

Running "flutter pub get" in layout_bug_example...                 253ms
Analyzing layout_bug_example...                                         
No issues found! (ran in 3.1s)
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400 darwin-arm, locale en-DE)
    • Flutter version 3.3.8 on channel stable at /Users/max/fvm/versions/3.3.8
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52b3dc25f6 (2 weeks ago), 2022-11-09 12:09:26 +0800
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/max/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/max/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Users/max/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/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 11.0.13+0-b1751.21-8125866)

[✓] Android Studio (version 2021.3)
    • Android Studio at /Users/max/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/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 11.0.13+0-b1751.21-8125866)

[✓] IntelliJ IDEA Community Edition (version 2022.2.3)
    • IntelliJ at /Users/max/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/222.4345.14/IntelliJ IDEA CE.app
    • 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

[✓] Connected device (4 available)
    • Pixel 7 (mobile)            • 29021FDH2004TJ • android-arm64  • Android 13 (API 33)
    • sdk gphone64 arm64 (mobile) • emulator-5554  • android-arm64  • Android 12 (API 31) (emulator)
    • macOS (desktop)             • macos          • darwin-arm64   • macOS 13.0.1 22A400 darwin-arm
    • Chrome (web)                • chrome         • web-javascript • Google Chrome 107.0.5304.110

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Not sure if I am not supposed to call hasChild during getSize. But since the documentation clearly states that this may be done

/// True if a non-null LayoutChild was provided for the specified id.
///
/// Call this from the [performLayout] or [getSize] methods to
/// determine which children are available, if the child list might
/// vary.
bool hasChild(Object childId) => _idToChild![childId] != null;

I assume this is either an issue with the documentation or with the framework.

@exaby73 exaby73 added the in triage Presently being triaged by the triage team label Nov 23, 2022
@exaby73
Copy link
Member

exaby73 commented Nov 23, 2022

Triage report

I can reproduce this issue on Master (3.6.0-7.0.pre.35)

Code Sample (Same as OP)
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: CustomMultiChildLayout(
        delegate: _MultiChildLayoutDelegate(),
        children: [
          LayoutId(
            id: 0,
            child: const SizedBox(
              width: 50,
              height: 50,
            ),
          ),
          LayoutId(
            id: 1,
            child: const SizedBox(
              width: 50,
              height: 50,
            ),
          ),
          LayoutId(
            id: 2,
            child: const SizedBox(
              width: 50,
              height: 50,
            ),
          )
        ],
      ),
    );
  }
}

class _MultiChildLayoutDelegate extends MultiChildLayoutDelegate {
  _MultiChildLayoutDelegate();

  @override
  Size getSize(BoxConstraints constraints) {
    hasChild(0);
    return Size(constraints.maxWidth, constraints.maxHeight);
  }

  @override
  void performLayout(Size size) {}

  @override
  bool shouldRelayout(covariant MultiChildLayoutDelegate oldDelegate) {
    return true;
  }
}
Logs
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following _CastError was thrown during performLayout():
Null check operator used on a null value

The relevant error-causing widget was:
  CustomMultiChildLayout
  CustomMultiChildLayout:file:///home/exabyt3/dev/nevercode/issue_115898/lib/main.dart:28:13

When the exception was thrown, this was the stack:
#0      MultiChildLayoutDelegate.hasChild (package:flutter/src/rendering/custom_layout.dart:133:46)
#1      _MultiChildLayoutDelegate.getSize (package:issue_115898/main.dart:63:5)
#2      RenderCustomMultiChildLayoutBox._getSize (package:flutter/src/rendering/custom_layout.dart:359:44)
#3      RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:409:12)
#4      RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#5      RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#6      MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#7      _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1080:7)
#8      MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
#9      RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:410:14)
#10     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#11     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#12     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#13     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#14     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#15     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#16     _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1467:11)
#17     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#18     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#19     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#20     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#21     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#22     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#23     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#24     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#25     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#26     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#27     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#28     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#29     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#30     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#31     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#32     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#33     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#34     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#35     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#36     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#37     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#38     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#39     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#40     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#41     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#42     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#43     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#44     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#45     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#46     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#47     RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3815:13)
#48     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#49     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#50     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#51     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#52     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#53     _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:856:15)
#54     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#55     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#56     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#57     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#58     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#59     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#60     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#61     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#62     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#63     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#64     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#65     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#66     RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:552:11)
#67     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#68     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#69     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#70     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#71     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#72     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#73     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#74     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#75     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#76     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#77     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#78     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#79     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#80     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#81     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#82     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#83     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#84     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120:14)
#85     RenderObject.layout (package:flutter/src/rendering/object.dart:2189:7)
#86     RenderBox.layout (package:flutter/src/rendering/box.dart:2430:11)
#87     RenderView.performLayout (package:flutter/src/rendering/view.dart:175:14)
#88     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2027:7)
#89     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1020:18)
#90     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:516:19)
#91     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:869:13)
#92     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:381:5)
#93     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1289:15)
#94     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1218:9)
#95     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:942:7)
#99     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)
(elided 3 frames from class _Timer and dart:async-patch)

The following RenderObject was being processed when the exception was fired: RenderCustomMultiChildLayoutBox#71e82 relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
  creator: CustomMultiChildLayout ← KeyedSubtree-[GlobalKey#bdc5b] ← _BodyBuilder ← MediaQuery ←
    LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← _ActionsMarker ← Actions ←
    AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#ce008 ink
    renderer] ← ⋯
  parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body (can use size)
  constraints: BoxConstraints(0.0<=w<=952.0, 0.0<=h<=1014.0)
  size: MISSING
This RenderObject had the following descendants (showing up to depth 5):
    child 1: RenderConstrainedBox#7ee0d NEEDS-LAYOUT NEEDS-PAINT
    child 2: RenderConstrainedBox#2dd2d NEEDS-LAYOUT NEEDS-PAINT
    child 3: RenderConstrainedBox#ed89d NEEDS-LAYOUT NEEDS-PAINT
════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: RenderBox was not laid out: RenderCustomMultiChildLayoutBox#71e82 relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

Another exception was thrown: Updated layout information required for RenderConstrainedBox#7ee0d NEEDS-LAYOUT NEEDS-PAINT to calculate semantics.
The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:35461/Le6dWbqzasA=/

Another exception was thrown: 'package:flutter/src/widgets/binding.dart': Failed assertion: line 842 pos 14: '!_firstFrameCompleter.isCompleted': is not true.

@exaby73 exaby73 added c: crash Stack traces logged to the console framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.3 Found to occur in 3.3 found in release: 3.6 Found to occur in 3.6 a: layout SystemChrome and Framework's Layout Issues and removed in triage Presently being triaged by the triage team labels Nov 23, 2022
@goderbauer goderbauer added the P2 Important issues not at the top of the work list label Nov 29, 2022
@TahaTesser
Copy link
Member

It seems like a documentation issue.

Looking into the source _idToChild is only assigned when layout and getSize is called before the layout.

flutter: getSize
flutter: performLayout

As expected _idToChild is null before layout.

hasChild looks for _idToChild which is not assigned until layout

bool hasChild(Object childId) => _idToChild![childId] != null;

@TahaTesser TahaTesser added the d: api docs Issues with https://api.flutter.dev/ label May 10, 2023
@TahaTesser TahaTesser self-assigned this May 10, 2023
auto-submit bot pushed a commit that referenced this issue May 11, 2023
fixes #115898

`hasChild` checks `_idToChild` map.  `_idToChild` is not assigned until `_callPerformLayout` is called.
So `hasChild` shouldn't be called in `getSize`.

https://github.com/flutter/flutter/blob/df789c9e76098e82f80f2c5de8b5560f360afa40/packages/flutter/lib/src/rendering/custom_layout.dart#L400-L404

Updated docs and example class names.
@exaby73 exaby73 added the r: fixed Issue is closed as already fixed in a newer version label May 13, 2023
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this issue May 24, 2023
fixes flutter#115898

`hasChild` checks `_idToChild` map.  `_idToChild` is not assigned until `_callPerformLayout` is called.
So `hasChild` shouldn't be called in `getSize`.

https://github.com/flutter/flutter/blob/df789c9e76098e82f80f2c5de8b5560f360afa40/packages/flutter/lib/src/rendering/custom_layout.dart#L400-L404

Updated docs and example class names.
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: layout SystemChrome and Framework's Layout Issues c: crash Stack traces logged to the console d: api docs Issues with https://api.flutter.dev/ found in release: 3.3 Found to occur in 3.3 found in release: 3.6 Found to occur in 3.6 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version
Projects
Status: Done (PR merged)
Development

Successfully merging a pull request may close this issue.

4 participants