{"action":"created","issue":{"url":"https://api.github.com/repos/flutter/flutter/issues/25377","repository_url":"https://api.github.com/repos/flutter/flutter","labels_url":"https://api.github.com/repos/flutter/flutter/issues/25377/labels{/name}","comments_url":"https://api.github.com/repos/flutter/flutter/issues/25377/comments","events_url":"https://api.github.com/repos/flutter/flutter/issues/25377/events","html_url":"https://github.com/flutter/flutter/issues/25377","id":391189157,"node_id":"MDU6SXNzdWUzOTExODkxNTc=","number":25377,"title":"Provide an API in the Flutter tool","user":{"login":"tvolkert","id":15253456,"node_id":"MDQ6VXNlcjE1MjUzNDU2","avatar_url":"https://avatars0.githubusercontent.com/u/15253456?v=4","gravatar_id":"","url":"https://api.github.com/users/tvolkert","html_url":"https://github.com/tvolkert","followers_url":"https://api.github.com/users/tvolkert/followers","following_url":"https://api.github.com/users/tvolkert/following{/other_user}","gists_url":"https://api.github.com/users/tvolkert/gists{/gist_id}","starred_url":"https://api.github.com/users/tvolkert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvolkert/subscriptions","organizations_url":"https://api.github.com/users/tvolkert/orgs","repos_url":"https://api.github.com/users/tvolkert/repos","events_url":"https://api.github.com/users/tvolkert/events{/privacy}","received_events_url":"https://api.github.com/users/tvolkert/received_events","type":"User","site_admin":false},"labels":[{"id":283479235,"node_id":"MDU6TGFiZWwyODM0NzkyMzU=","url":"https://api.github.com/repos/flutter/flutter/labels/severe:%20new%20feature","name":"severe: new feature","color":"ffff00","default":false},{"id":283480100,"node_id":"MDU6TGFiZWwyODM0ODAxMDA=","url":"https://api.github.com/repos/flutter/flutter/labels/tool","name":"tool","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/flutter/flutter/milestones/22","html_url":"https://github.com/flutter/flutter/milestone/22","labels_url":"https://api.github.com/repos/flutter/flutter/milestones/22/labels","id":2270094,"node_id":"MDk6TWlsZXN0b25lMjI3MDA5NA==","number":22,"title":"Goals","description":"P2: These are tasks we think are worth fixing in the coming years. It includes issues we've identified that might block fully shipping broad consumer-facing apps, correctness issues, and bugs relating to polish and quality.\r\n\r\nThe date on this milestone is utterly arbitrary and just intended to sort the milestone appropriately.","creator":{"login":"Hixie","id":551196,"node_id":"MDQ6VXNlcjU1MTE5Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/551196?v=4","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},"open_issues":1998,"closed_issues":920,"state":"open","created_at":"2017-01-23T00:27:59Z","updated_at":"2018-12-19T17:44:48Z","due_on":"2031-01-01T08:00:00Z","closed_at":null},"comments":0,"created_at":"2018-12-14T16:55:33Z","updated_at":"2018-12-19T17:51:26Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Right now, the Flutter tool is somewhat extensible by wrapping `main()` in a project-specific `main()` method, that uses combinations of `AppContext.run()` and the top-level `run()` function to override certain behaviors of the tool:\r\n\r\nhttps://github.com/flutter/flutter/blob/d675bbbd3a0f1e0992961e52161227c6ee37d0e8/packages/flutter_tools/lib/runner.dart#L29\r\n\r\nfor instance, the code would look something like this:\r\n\r\n```dart\r\nimport 'package:flutter_tools/runner.dart' as runner;\r\nimport 'package:flutter_tools/src/base/context.dart';\r\nimport 'package:flutter_tools/src/commands/config.dart';\r\nimport 'package:flutter_tools/src/commands/daemon.dart';\r\nimport 'package:flutter_tools/src/commands/devices.dart';\r\nimport 'package:flutter_tools/src/commands/logs.dart';\r\nimport 'package:flutter_tools/src/runner/flutter_command.dart';\r\n\r\nFuture<Null> main(List<String> args) async {\r\n  final Map<Type, Generator> overrides = await _getProjectSpecificOverrides();\r\n\r\n  await context.run(\r\n    overrides: overrides,\r\n    body: () {\r\n      return runner.run(args, <FlutterCommand>[\r\n        new _ProjectSpecificAttachCommand(),\r\n        new ConfigCommand(),\r\n        new DaemonCommand(),\r\n        new DevicesCommand(),\r\n        new _ProjectSpecificDoctorCommand(),\r\n        new LogsCommand(),\r\n        new _ProjectSpecificRunCommand(),\r\n      ]);\r\n    },\r\n  );\r\n}\r\n```\r\n\r\nThe problem with this is that in order to accomplish this behavior, the project has to reach into implementation files in `flutter_tools`, as well as the fact that this is all undocumented because it's not an official API.\r\n\r\nThere are a growing number of use cases for making the Flutter tool extensible, such as allowing project to:\r\n\r\n* wire up code generation as part of their build (and likewise for hot reload)\r\n* wire up C/C++ compilation as part of their build (moreso when https://github.com/dart-lang/sdk/issues/34452 and https://github.com/flutter/flutter/issues/7053 are implemented)\r\n* Support a different enumeration of device types (e.g. desktop embedders)\r\n* Expose a Flutter tool \"plugin\", such that other Flutter projects can customize their developer experience just by installing a set of plugins\r\n\r\nFor a targeted set of use cases, we should expose an API in the Flutter tool for how such projects could import & extend the tool.\r\n"},"comment":{"url":"https://api.github.com/repos/flutter/flutter/issues/comments/448685749","html_url":"https://github.com/flutter/flutter/issues/25377#issuecomment-448685749","issue_url":"https://api.github.com/repos/flutter/flutter/issues/25377","id":448685749,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODY4NTc0OQ==","user":{"login":"zoechi","id":405837,"node_id":"MDQ6VXNlcjQwNTgzNw==","avatar_url":"https://avatars0.githubusercontent.com/u/405837?v=4","gravatar_id":"","url":"https://api.github.com/users/zoechi","html_url":"https://github.com/zoechi","followers_url":"https://api.github.com/users/zoechi/followers","following_url":"https://api.github.com/users/zoechi/following{/other_user}","gists_url":"https://api.github.com/users/zoechi/gists{/gist_id}","starred_url":"https://api.github.com/users/zoechi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoechi/subscriptions","organizations_url":"https://api.github.com/users/zoechi/orgs","repos_url":"https://api.github.com/users/zoechi/repos","events_url":"https://api.github.com/users/zoechi/events{/privacy}","received_events_url":"https://api.github.com/users/zoechi/received_events","type":"User","site_admin":false},"created_at":"2018-12-19T17:51:26Z","updated_at":"2018-12-19T17:51:26Z","author_association":"CONTRIBUTOR","body":"Is this related to #9870?"}}
{"actor":{"display_login":"zoechi"}}