Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/utilities.dart

Issue 2768273003: <Widget> boilerplate for Flutter `children:` suggestions. (Closed)
Patch Set: format Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6d8ce556bafc0b38ca84bb683a8133456d88ebee..7b888c638f034111c2cf7622d4c10c6e9652259e 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
@@ -80,7 +80,7 @@ void addDefaultArgDetails(
for (ParameterElement param in constructorElement.parameters) {
if (param.name == 'children') {
DartType type = param.type;
- if (type is InterfaceType && _isDartList(type)) {
+ if (type is InterfaceType && isDartList(type)) {
InterfaceType interfaceType = type;
List<DartType> typeArguments = interfaceType.typeArguments;
if (typeArguments.length == 1) {
@@ -184,6 +184,14 @@ CompletionSuggestion createLocalSuggestion(SimpleIdentifier id,
return suggestion;
}
+bool isDartList(DartType type) {
+ ClassElement element = type.element;
+ if (element != null) {
+ return element.name == "List" && element.library.isDartCore;
+ }
+ return false;
+}
+
/**
* Return `true` if the @deprecated annotation is present on the given [node].
*/
@@ -230,11 +238,3 @@ String nameForType(TypeAnnotation type) {
}
String _getDefaultValue(ParameterElement param) => 'null';
-
-bool _isDartList(DartType type) {
- ClassElement element = type.element;
- if (element != null) {
- return element.name == "List" && element.library.isDartCore;
- }
- return false;
-}

Powered by Google App Engine
This is Rietveld 408576698