{"action":"opened","issue":{"url":"https://api.github.com/repos/flutter/flutter/issues/5820","repository_url":"https://api.github.com/repos/flutter/flutter","labels_url":"https://api.github.com/repos/flutter/flutter/issues/5820/labels{/name}","comments_url":"https://api.github.com/repos/flutter/flutter/issues/5820/comments","events_url":"https://api.github.com/repos/flutter/flutter/issues/5820/events","html_url":"https://github.com/flutter/flutter/issues/5820","id":176432413,"number":5820,"title":"setState in LayoutBuilder callback gives incomprehensible exception","user":{"login":"apwilson","id":142874,"avatar_url":"https://avatars.githubusercontent.com/u/142874?v=3","gravatar_id":"","url":"https://api.github.com/users/apwilson","html_url":"https://github.com/apwilson","followers_url":"https://api.github.com/users/apwilson/followers","following_url":"https://api.github.com/users/apwilson/following{/other_user}","gists_url":"https://api.github.com/users/apwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/apwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apwilson/subscriptions","organizations_url":"https://api.github.com/users/apwilson/orgs","repos_url":"https://api.github.com/users/apwilson/repos","events_url":"https://api.github.com/users/apwilson/events{/privacy}","received_events_url":"https://api.github.com/users/apwilson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-12T17:18:14Z","updated_at":"2016-09-12T17:18:14Z","closed_at":null,"body":"Test code:\r\n```dart\r\nFuture main() async {\r\n  runApp(new Foo());\r\n}\r\n\r\nclass Foo extends StatefulWidget {\r\n  Foo({Key key}) : super(key: key);\r\n\r\n  @override\r\n  FooState createState() => new FooState();\r\n}\r\n\r\nclass FooState extends State<Foo> {\r\n  @override\r\n  Widget build(BuildContext context) => new LayoutBuilder(\r\n        builder: (BuildContext context, BoxConstraints constraints) {\r\n          setState(() {});\r\n          return new Container();\r\n        },\r\n      );\r\n}\r\n```\r\n\r\nException:\r\n```\r\n10:15:52.486: I/flutter : ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════\r\n10:15:52.491: I/flutter : The following assertion was thrown during performLayout():\r\n10:15:52.499: I/flutter : 'package:flutter/src/widgets/framework.dart': Failed assertion: line 1539 pos 16:\r\n10:15:52.502: I/flutter : '!_dirtyElements[index]._active || _dirtyElements[index]._debugIsInScope(context)' is not true.\r\n10:15:52.525: I/flutter : When the exception was thrown, this was the stack:\r\n10:15:52.536: I/flutter : #2      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:1539:16)\r\n10:15:52.538: I/flutter : #3      _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:102:11)\r\n10:15:52.540: I/flutter : #4      RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1644:58)\r\n10:15:52.543: I/flutter : #5      PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:896:15)\r\n10:15:52.546: I/flutter : #6      RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1644:13)\r\n10:15:52.548: I/flutter : #7      _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:201:5)\r\n10:15:52.551: I/flutter : #8      RenderObject.layout (package:flutter/src/rendering/object.dart:1546:21)\r\n10:15:52.553: I/flutter : #9      RenderView.performLayout (package:flutter/src/rendering/view.dart:113:13)\r\n10:15:52.556: I/flutter : #10     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1424:21)\r\n10:15:52.559: I/flutter : #11     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:874:18)\r\n10:15:52.561: I/flutter : #12     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding.beginFrame (package:flutter/src/rendering/binding.dart:202:19)\r\n10:15:52.564: I/flutter : #13     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding&WidgetsBinding.beginFrame (package:flutter/src/widgets/binding.dart:297:23)\r\n10:15:52.567: I/flutter : #14     BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:147:5)\r\n10:15:52.570: I/flutter : #15     BindingBase&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:608:15)\r\n10:15:52.573: I/flutter : #16     BindingBase&SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:543:9)\r\n10:15:52.575: I/flutter : #17     runApp (package:flutter/src/widgets/binding.dart:363:7)\r\n10:15:52.578: I/flutter : #18     main.<main_async_body> (<redacted>/lib/main.dart:14:3)\r\n10:15:52.580: I/flutter : (elided 5 frames from class _AssertionError and package dart:async)\r\n10:15:52.582: I/flutter : The following RenderObject was being processed when the exception was fired:\r\n10:15:52.584: I/flutter :   _RenderLayoutBuilder NEEDS-LAYOUT\r\n10:15:52.587: I/flutter : This RenderObject had the following creator information:\r\n10:15:52.589: I/flutter :   LayoutBuilder ← Foo ← [root]\r\n10:15:52.591: I/flutter : This RenderObject had the following child:\r\n10:15:52.594: I/flutter :   RenderConstrainedBox NEEDS-LAYOUT\r\n10:15:52.596: I/flutter : ════════════════════════════════════════════════════════════════════════════════════════════════════\r\n10:15:52.598: I/flutter : Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1867 pos 12: '!_needsLayout' is not true.\r\n\r\n```"}}
{"actor":{"display_login":"apwilson"}}