You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stf/Stl Snippets now using /src/foundation/key.dart' & '/src/widgets/framework.dart' ? #3988
Hi everyone.
It's hard for me to undestand it I made something wrong or if its coincidently occurs after upgradiing flutter.
But suddenlly, using snippetts "stl" or "stf' have changed and don't use anymore "import 'package:flutter/material.dart;" but theses instead
Obiously I paid attention to disable as many Vscode extension as possible to ensure that none interfers...
Does anyome have an idea if I messed up somewhere ?
You didn't mess up, and this did indeed start with the Flutter upgrade. Snippets are moving from the VS Code extension to the language server, and Flutter 3.0 was the first version that included them. The reason for this is to allow the snippets to adapt to language versions and new features (previously the snippet could not conditionally insert ? for nullable fields depending on your language version, nor user super initializers, because it was fixed for all versions).
The server snippets automatically add imports for new types that are referenced (the old snippets did not add imports), but unfortunately it references their source files directly. If you already have imports in the file, it should leave them off, but in a new file it's causing this problem.
There's an issue open tracking this at dart-lang/sdk#49081. I'll close this one in favour of that.
Activity
DanTup commentedon May 23, 2022
You didn't mess up, and this did indeed start with the Flutter upgrade. Snippets are moving from the VS Code extension to the language server, and Flutter 3.0 was the first version that included them. The reason for this is to allow the snippets to adapt to language versions and new features (previously the snippet could not conditionally insert
?for nullable fields depending on your language version, nor user super initializers, because it was fixed for all versions).The server snippets automatically add imports for new types that are referenced (the old snippets did not add imports), but unfortunately it references their source files directly. If you already have imports in the file, it should leave them off, but in a new file it's causing this problem.
There's an issue open tracking this at dart-lang/sdk#49081. I'll close this one in favour of that.