-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Description
Background
Flutter is easily embeddable in a variety of platforms and environments. While the tool will still build out first class support for several platforms, there are a growing number of alternatives being developed as well. Ideally a developer that targets an alternative embedding would be able to benefit from as much of the existing flutter tooling as possible. This would both improve the usability of Flutter in different environments, and make it easier to stand-up new environment's tooling.
Originally this was proposed via a Dart API in the flutter tool. I investigated this approach in 2019 and found that problem had a much larger scope than we had resources to work on. It required defining and stabilizing APIs for building, installation, and doctor checks, which would be both difficult the design given the lack of current usage and difficult to change in the future if usage increased. Without ruling out this approach in the future, there are some incremental steps we could take to improve usability.
Arbitrary embedder discovery
flutter attach almost supports discovery of arbitrary embedders, and with a few adjustments could become generally usable for this.
Using mDNS, the tool can discover Dart VMs running on iOS devices, but there is no reason we could not generalize this to more platforms. The requirement for the embedder side would be to either advertise via the Dart VM automatically, or otherwise manually implement some variety of debug-only broadcast.
caveat: There were issues getting mDNS to work on Android devices, so this may be limited in other ways we're not aware of. FYI @dnfield
The tool could then easily attach to these instances and support feature discovery to determine build mode and dart platform (dart v fuchsia)
IDE integration
Currently Intellij and vscode have a drop-down selector for devices that can be targeted for flutter run. We could similarly implement an "instance dropdown" for Android, iOS, and other instances that could be attached to.