Index: pkg/analysis_server/lib/src/services/completion/dart/utilities.dart |
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart |
index bd4421d4a59342e33507e58304d00bd886ccb992..b97eb588162eec04b90d514c421e32417720ea41 100644 |
--- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart |
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart |
@@ -178,18 +178,22 @@ CompletionSuggestion createLocalSuggestion(SimpleIdentifier id, |
} |
String getDefaultStringParameterValue(ParameterElement param) { |
- DartType type = param.type; |
- if (type is InterfaceType && isDartList(type)) { |
- List<DartType> typeArguments = type.typeArguments; |
- StringBuffer sb = new StringBuffer(); |
- if (typeArguments.length == 1) { |
- DartType typeArg = typeArguments.first; |
- if (!typeArg.isDynamic) { |
- sb.write('<${typeArg.name}>'); |
+ if (param != null) { |
+ DartType type = param.type; |
+ if (type is InterfaceType && isDartList(type)) { |
+ List<DartType> typeArguments = type.typeArguments; |
+ if (typeArguments.length == 1) { |
+ DartType typeArg = typeArguments.first; |
+ String typeInfo = !typeArg.isDynamic ? '<${typeArg.name}>' : ''; |
+ return '$typeInfo[]'; |
} |
- sb.write('[]'); |
- return sb.toString(); |
} |
+ if (type is FunctionType) { |
+ String params = type.parameters.map((p) => p.name).join(', '); |
+ //TODO(pq): consider adding a `TODO:` message in generated stub |
+ return '($params) {}'; |
+ } |
+ //TODO(pq): support map literals |
} |
return null; |
} |