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

Unified Diff: pkg/analysis_server/lib/src/services/correction/flutter_util.dart

Issue 2771653002: Completion boilerplate for Flutter cons children (flutter-intellij#463) (Closed)
Patch Set: 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/correction/flutter_util.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/flutter_util.dart b/pkg/analysis_server/lib/src/services/correction/flutter_util.dart
index 1959532be9d5d7479bf35b96cd1c5afe943096d6..469263e4c89616314c03992c09108a549c75b7ce 100644
--- a/pkg/analysis_server/lib/src/services/correction/flutter_util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/flutter_util.dart
@@ -160,6 +160,14 @@ InstanceCreationExpression identifyNewExpression(AstNode node) {
*/
bool isFlutterInstanceCreationExpression(InstanceCreationExpression newExpr) {
ClassElement classElement = newExpr.staticElement?.enclosingElement;
+ return isFlutterWidget(classElement);
+}
+
+/**
+ * Return `true` if the given [classElement] has the Flutter class Widget as a
+ * superclass.
+ */
+bool isFlutterWidget(ClassElement classElement) {
InterfaceType superType = classElement?.allSupertypes?.firstWhere(
(InterfaceType type) => _FLUTTER_WIDGET_NAME == type.name,
orElse: () => null);

Powered by Google App Engine
This is Rietveld 408576698