@@ -1235,7 +1235,11 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
12351235 declarationHelper (mustBeType: true ).addLexicalDeclarations (node);
12361236 } else if (offset < name.offset) {
12371237 keywordHelper.addFieldDeclarationKeywords (node);
1238- _forTypeAnnotation (node, mustBeNonVoid: firstField.equals != null );
1238+ _forTypeAnnotation (
1239+ node,
1240+ mustBeNonVoid: firstField.equals != null ,
1241+ isInDeclaration: true ,
1242+ );
12391243 } else if (offset <= name.end) {
12401244 keywordHelper.addFieldDeclarationKeywords (node);
12411245 }
@@ -1881,7 +1885,7 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
18811885 collector.completionLocation = 'ClassDeclaration_member' ;
18821886 if (offset >= node.firstTokenAfterCommentAndMetadata.previous! .offset &&
18831887 offset <= node.name.end) {
1884- _forTypeAnnotation (node);
1888+ _forTypeAnnotation (node, isInDeclaration : true );
18851889 // If the cursor is at the beginning of the declaration, include the class
18861890 // member keywords. See dartbug.com/41039.
18871891 keywordHelper.addClassMemberKeywords ();
@@ -3742,8 +3746,12 @@ class InScopeCompletionPass extends SimpleAstVisitor<void> {
37423746 bool mustBeNonVoid = false ,
37433747 bool excludeTypeNames = false ,
37443748 Set <AstNode > excludedNodes = const {},
3749+ bool isInDeclaration = false ,
37453750 }) {
3746- if (! (mustBeExtensible || mustBeImplementable || mustBeMixable)) {
3751+ if (! (mustBeExtensible ||
3752+ mustBeImplementable ||
3753+ mustBeMixable ||
3754+ isInDeclaration)) {
37473755 keywordHelper.addKeyword (Keyword .DYNAMIC );
37483756 if (! mustBeNonVoid) {
37493757 keywordHelper.addKeyword (Keyword .VOID );
0 commit comments