Skip to content

Previewing Dart code completions powered by machine learning

Michael Thomsen edited this page Sep 7, 2019 · 8 revisions

We have a new Dart developer productivity feature ready for preview. The feature augments traditional Dart code completion with new predictions based on machine learning.

The predictions are based on a local model — powered by TensorFlow Lite — so the predictions are made locally and offline. The training dataset is open-source Dart code from GitHub.

Required build

We recommend using the Flutter dev channel, v1.10.0 or later, or a Dart dev channel if you want to preview it to ensure you get our most recent performance and stability improvements during the preview.

Enabling the preview

VS Code

  • Enable the following settings in settings.json (this can be your global settings.json, or a workspace specific settings.json)
    • "dart.analyzerAdditionalArgs": ["--enable-completion-model"]
      This enables the ML completions experiment.

    • "editor.suggestSelection": "first".
      This ensures that Code shows the first available completion (Code has different default where it tried to remember past completions).

      image4

IntelliJ / Android Studio

  • Open the *Registry from the Actions menu

    image5

  • Edit the dart.server.additional.arguments configuration value to include the command-line argument: --enable-completion-model

    image3

Providing feedback

If you have feedback, please log a bug using this link. When reporting a bug, please include the following:

  1. Detailed repro steps
  2. Version output from flutter --version / dart --version
  3. A detailed description or screenshot of the completions seen
You can’t perform that action at this time.