diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index aab955a29a..52300eda67 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -70,7 +70,7 @@ typedef void GlobalKeyRemoveListener(GlobalKey key); /// A GlobalKey is one that must be unique across the entire application. It is /// used by components that need to communicate with other components across the /// application's element tree. -abstract class GlobalKey extends Key { +abstract class GlobalKey> extends Key { const GlobalKey.constructor() : super.constructor(); // so that subclasses can call us, since the Key() factory constructor shadows the implicit constructor /// Constructs a LabeledGlobalKey, which is a GlobalKey with a label used for debugging. @@ -118,8 +118,10 @@ abstract class GlobalKey extends Key { Widget get currentWidget => _currentElement?.widget; T get currentState { Element element = _currentElement; - if (element is StatefulComponentElement) - return element.state; + if (element is StatefulComponentElement) { + StatefulComponentElement statefulElement = element; + return statefulElement.state; + } return null; } @@ -172,7 +174,7 @@ abstract class GlobalKey extends Key { /// Each LabeledGlobalKey instance is a unique key. /// The optional label can be used for documentary purposes. It does not affect /// the key's identity. -class LabeledGlobalKey extends GlobalKey { +class LabeledGlobalKey> extends GlobalKey { const LabeledGlobalKey(this._label) : super.constructor(); final String _label; String toString() => '[GlobalKey ${_label != null ? _label : hashCode}]'; diff --git a/packages/flutter/pubspec.yaml b/packages/flutter/pubspec.yaml index 3b172b75ec..22fea30afa 100644 --- a/packages/flutter/pubspec.yaml +++ b/packages/flutter/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: newton: '>=0.1.4 <0.2.0' sky_engine: 0.0.43 sky_services: 0.0.43 - sky_tools: '>=0.0.25 <0.1.0' + sky_tools: '>=0.0.28 <0.1.0' vector_math: '>=1.4.3 <2.0.0' environment: sdk: '>=1.12.0 <2.0.0'