I got a repro from @nbros for this issue that several people had mentioned still having, but we couldn't previously reproduce. I see this on current Flutter master, which includes the previous fixes.
Take this code:
import 'package:english_words/english_words.dart';
import 'package:flutter/material.dart';
class Foo {
final Wor
void build() {
const a = EdgeInsets.all(16);
}
}
and invoke completion after Wor and select WordPair, and it'll insert prefix0.WordPair. Yet if you comment out the line const a = EdgeInsets... and then repeat, it will not insert the prefix (though I'm not entirely sure why).
The request/response look like this:
{
"id": "37",
"method": "completion.getSuggestionDetails",
"params": {
"file": "/Users/dantup/Desktop/wwwwwww/lib/main.dart",
"id": 706,
"label": "WordPair",
"offset": 115
},
"clientRequestTime": 1566292990249
}
{
"id": "37",
"result": {
"completion": "prefix0.WordPair",
"change": {
"message": "",
"edits": [
{
"file": "/Users/dantup/Desktop/wwwwwww/lib/main.dart",
"fileStamp": 0,
"edits": [
{
"offset": 50,
"length": 0,
"replacement": "\nimport 'package:english_words/english_words.dart' as prefix0;"
}
]
}
],
"linkedEditGroups": []
}
}
}
(cc @scheglov)
Not sure if a _"me too!"_ is useful or not, but I've been encountering this with my Jetbrains IDEs, at least with the standalone Dart SDK, _maybe on 1.7.8+hotfix.3 on the Flutter stable channel_.
dart --version
Dart VM version: 2.4.1 (Wed Aug 7 13:15:56 2019 +0200) on "macos_x64"
Thanks for the quick fix!
Thanks for the fix.
Is it already included in Dart 3.5?
I'm still having the 'prefix0.' issue.
https://github.com/dart-lang/sdk/commit/04bd34ed879c3d14ad67a1dd0fe0cbd19d10abd0 shows in which versions this change is. I'm not sure what is Dart 3.5.

Nevermind, 3.5 was actually the version of the Visual Studio Code plugin...
(https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code)
Since the latest Dart stable release would be 2.5.1 (https://dart.dev/get-dart) and your commit for 2.6?, we have to be more patient for the fix to arrive in stable, correct?
That's correct - though if you want to test out if the fix works, you could try with a dev version of the SDK from here:
https://dart.dev/tools/sdk/archive
If you use the dart.sdkPaths setting in VS Code, you can easily swap between SDKs from the status bar (see https://dartcode.org/docs/quickly-switching-between-sdk-versions/) which might be useful to avoid changing PATH (changing SDK applies only to the current workspace - written to the workspace settings). I use this a lot to switch between stable, dev, nightly SDKs.
Thanks for the tip.
I've found another weird thing, but idk if it's related to dart or the visual studio code plugin or something else. I will just ask here (please tell me if I should rather delete this comment):
When the editor helps and adds missing case clauses for a switch:
If the '{ }' are in the same line, it will add the case clauses too high, even above the switch():

If I put enter between '{' and '}' it works as expected:

@nohli I can reproduce that in Android Studio, so it seems like a bug in the assist. Please file a new bug here in the SDK repo for that. Thanks!