From e69611d2666f9b8fb929763a358701a1a11ab780 Mon Sep 17 00:00:00 2001 From: Hixie Date: Wed, 21 Oct 2015 10:03:11 -0700 Subject: [PATCH] UniqueKey Sometimes you need a Key (not a GlobalKey) that is only equal to itself but can be used multiple times in the tree. Enter UniqueKey! --- sky/packages/sky/lib/src/widgets/framework.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sky/packages/sky/lib/src/widgets/framework.dart b/sky/packages/sky/lib/src/widgets/framework.dart index 2a5aedc7b85..a3b6409d8db 100644 --- a/sky/packages/sky/lib/src/widgets/framework.dart +++ b/sky/packages/sky/lib/src/widgets/framework.dart @@ -42,6 +42,12 @@ class ValueKey extends Key { String toString() => '[\'$value\']'; } +/// A [Key] that is only equal to itself. +class UniqueKey extends Key { + const UniqueKey() : super.constructor(); + String toString() => '[$hashCode]'; +} + /// A kind of [Key] that takes its identity from the object used as its value. /// /// Used to tie the identity of a Widget to the identity of an object used to