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
Crash when modifying GlobalKey Widget index and parent in Column's Children #120762
Labels
c: crash
Stack traces logged to the console
found in release: 3.7
Found to occur in 3.7
found in release: 3.8
Found to occur in 3.8
framework
flutter/packages/flutter repository. See also f: labels.
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
r: fixed
Issue is closed as already fixed in a newer version
Comments
8 tasks
8 tasks
Triage reportI can reproduce this issue on Code Sample (Same as OP)import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final GlobalKey _globalKey = GlobalKey();
bool _updated = false;
@override
Widget build(BuildContext context) {
late List<Widget> widgets;
if (_updated) {
widgets = [
const Text("1"),
const Text("3"),
SizedBox(child: Text("2", key: _globalKey)),
];
} else {
widgets = [
const Text("1"),
Text("2", key: _globalKey),
const Text("3"),
];
}
return MaterialApp(
home: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: widgets,
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() => _updated = true);
},
tooltip: 'Run',
child: const Icon(Icons.play_arrow),
),
),
);
}
} Logs#201 Element.rebuild
framework.dart:4672
#202 StatefulElement.update
framework.dart:5140
#203 Element.updateChild
framework.dart:3655
#204 ComponentElement.performRebuild
framework.dart:4977
#205 StatefulElement.performRebuild
framework.dart:5117
#206 Element.rebuild
framework.dart:4672
#207 StatefulElement.update
framework.dart:5140
#208 Element.updateChild
framework.dart:3655
#209 ComponentElement.performRebuild
framework.dart:4977
#210 StatefulElement.performRebuild
framework.dart:5117
#211 Element.rebuild
framework.dart:4672
#212 BuildOwner.buildScope
framework.dart:2749
#213 WidgetsBinding.drawFrame
binding.dart:866
#214 RendererBinding._handlePersistentFrameCallback
binding.dart:378
#215 SchedulerBinding._invokeFrameCallback
binding.dart:1286
#216 SchedulerBinding.handleDrawFrame
binding.dart:1216
#217 SchedulerBinding._handleDrawFrame
binding.dart:1074
#218 _invoke (dart:ui/hooks.dart:142:13)
#219 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:338:5)
#220 _drawFrame (dart:ui/hooks.dart:112:31)
(elided 2 frames from class _AssertionError)
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
Each child must be laid out exactly once.
The relevant error-causing widget was
Scaffold
main.dart:35
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by scheduler library ═════════════════════════════════
Updated layout information required for RenderErrorBox#a9242 NEEDS-LAYOUT NEEDS-PAINT to calculate semantics.
'package:flutter/src/rendering/object.dart':
object.dart:1
Failed assertion: line 3242 pos 12: '!_needsLayout'
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Duplicate GlobalKey detected in widget tree.
════════════════════════════════════════════════════════════════════════════════ |
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.7
Found to occur in 3.7
found in release: 3.8
Found to occur in 3.8
and removed
in triage
Presently being triaged by the triage team
labels
Feb 15, 2023
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 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
c: crash
Stack traces logged to the console
found in release: 3.7
Found to occur in 3.7
found in release: 3.8
Found to occur in 3.8
framework
flutter/packages/flutter repository. See also f: labels.
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
r: fixed
Issue is closed as already fixed in a newer version
Steps to Reproduce
flutter run
on the code sampleCode sample
Logs
The text was updated successfully, but these errors were encountered: