From c4c8019135950783fb946817087e0325a18cfa1f Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Fri, 26 Aug 2016 13:32:23 -0700 Subject: [PATCH] GlobalObjectKey should be generic (#5619) Somehow we missed this before. Fixes https://github.com/flutter/flutter/issues/5615 --- packages/flutter/lib/src/widgets/app.dart | 4 ++-- packages/flutter/lib/src/widgets/framework.dart | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/flutter/lib/src/widgets/app.dart b/packages/flutter/lib/src/widgets/app.dart index e26f36c9b3..879fc07086 100644 --- a/packages/flutter/lib/src/widgets/app.dart +++ b/packages/flutter/lib/src/widgets/app.dart @@ -109,13 +109,13 @@ class WidgetsApp extends StatefulWidget { } class _WidgetsAppState extends State implements WidgetsBindingObserver { - GlobalObjectKey _navigator; + GlobalObjectKey _navigator; LocaleQueryData _localeData; @override void initState() { super.initState(); - _navigator = new GlobalObjectKey(this); + _navigator = new GlobalObjectKey(this); didChangeLocale(ui.window.locale); WidgetsBinding.instance.addObserver(this); } diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 86fdf923c8..a49dd91bfd 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -272,6 +272,7 @@ abstract class GlobalKey> extends Key { /// /// The debug label is useful for documentation and for debugging. The label /// does not affect the key's identity. +@optionalTypeArgs class LabeledGlobalKey> extends GlobalKey { /// Creates a global key with a debugging label. /// @@ -288,7 +289,8 @@ class LabeledGlobalKey> extends GlobalKey { /// /// Used to tie the identity of a widget to the identity of an object used to /// generate that widget. -class GlobalObjectKey extends GlobalKey { +@optionalTypeArgs +class GlobalObjectKey> extends GlobalKey { /// Creates a global key that uses [identical] on [value] for its [operator==]. const GlobalObjectKey(this.value) : super.constructor(); @@ -297,9 +299,9 @@ class GlobalObjectKey extends GlobalKey { @override bool operator ==(dynamic other) { - if (other is! GlobalObjectKey) + if (other is! GlobalObjectKey) return false; - final GlobalObjectKey typedOther = other; + final GlobalObjectKey typedOther = other; return identical(value, typedOther.value); }