{"action":"created","issue":{"url":"https://api.github.com/repos/flutter/flutter/issues/1272","labels_url":"https://api.github.com/repos/flutter/flutter/issues/1272/labels{/name}","comments_url":"https://api.github.com/repos/flutter/flutter/issues/1272/comments","events_url":"https://api.github.com/repos/flutter/flutter/issues/1272/events","html_url":"https://github.com/flutter/flutter/issues/1272","id":126978587,"number":1272,"title":"Forgetting a Widget's build() context argument can lead to confusion","user":{"login":"HansMuller","id":1377460,"avatar_url":"https://avatars.githubusercontent.com/u/1377460?v=3","gravatar_id":"","url":"https://api.github.com/users/HansMuller","html_url":"https://github.com/HansMuller","followers_url":"https://api.github.com/users/HansMuller/followers","following_url":"https://api.github.com/users/HansMuller/following{/other_user}","gists_url":"https://api.github.com/users/HansMuller/gists{/gist_id}","starred_url":"https://api.github.com/users/HansMuller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HansMuller/subscriptions","organizations_url":"https://api.github.com/users/HansMuller/orgs","repos_url":"https://api.github.com/users/HansMuller/repos","events_url":"https://api.github.com/users/HansMuller/events{/privacy}","received_events_url":"https://api.github.com/users/HansMuller/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/flutter/flutter/labels/affects:%20dev%20experience","name":"affects: dev experience","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-15T23:19:24Z","updated_at":"2016-01-15T23:21:25Z","closed_at":null,"body":"The trivial app below is wrong because the build function is missing its BuildContext argument. I have made this mistake several times.\r\n\r\n```\r\nimport 'package:flutter/material.dart';\r\n\r\nclass BadApp extends StatelessComponent {\r\n\r\n  Widget build() {\r\n    return new Text(\"FAIL\");\r\n  }\r\n}\r\n\r\nvoid main() {\r\n  runApp(new MaterialApp(\r\n    routes: {\r\n      '/': (RouteArguments args) => new BadApp()\r\n    }\r\n  ));\r\n}\r\n```\r\nI assume that the analyzer would have warned me off running the app. Doing so yields 128 stack frames, only one of which comes from the app.  The failure mode is somewhat confusing, moreso in the context of a larger app.\r\n\r\n```\r\nandroid: --------- beginning of system\r\nandroid: I/flutter : -- EXCEPTION CAUGHT BY WIDGETS LIBRARY ---------------------------------\r\nandroid: I/flutter : Exception caught while building _ModalScopeStatus(active)\r\nandroid: I/flutter : type '() => Widget' is not a subtype of type 'WidgetBuilder' of 'value'.\r\nandroid: I/flutter : Stack trace:\r\nandroid: I/flutter : #0      ComponentElement._builder= (packages/flutter/src/widgets/framework.dart:1136)\r\nandroid: I/flutter : #1      StatelessComponentElement.StatelessComponentElement (packages/flutter/src/widgets/framework.dart:1206)\r\nandroid: I/flutter : #2      StatelessComponent.createElement (packages/flutter/src/widgets/framework.dart:309)\r\n...\r\nandroid: I/flutter : #128    main (/builds/dev/flutter/examples/widgets/test.dart:15)\r\n```\r\n\r\nI don't know if it would be worth doing something about this. \r\n"},"comment":{"url":"https://api.github.com/repos/flutter/flutter/issues/comments/172124407","html_url":"https://github.com/flutter/flutter/issues/1272#issuecomment-172124407","issue_url":"https://api.github.com/repos/flutter/flutter/issues/1272","id":172124407,"user":{"login":"Hixie","id":551196,"avatar_url":"https://avatars.githubusercontent.com/u/551196?v=3","gravatar_id":"","url":"https://api.github.com/users/Hixie","html_url":"https://github.com/Hixie","followers_url":"https://api.github.com/users/Hixie/followers","following_url":"https://api.github.com/users/Hixie/following{/other_user}","gists_url":"https://api.github.com/users/Hixie/gists{/gist_id}","starred_url":"https://api.github.com/users/Hixie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hixie/subscriptions","organizations_url":"https://api.github.com/users/Hixie/orgs","repos_url":"https://api.github.com/users/Hixie/repos","events_url":"https://api.github.com/users/Hixie/events{/privacy}","received_events_url":"https://api.github.com/users/Hixie/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T23:21:24Z","updated_at":"2016-01-15T23:21:24Z","body":"The analyzer _didn't_ say anything??"}}