From 0bec3dc3d280e38e70f35e3fc023f2aa4f0833a7 Mon Sep 17 00:00:00 2001 From: Shi-Hao Hong Date: Tue, 10 Dec 2019 13:24:58 -0500 Subject: [PATCH] Add UniqueKey documentation regarding const constructor (#46647) --- packages/flutter/lib/src/widgets/framework.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index a8e22f8d22..f6084e43ce 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -39,8 +39,15 @@ export 'package:flutter/rendering.dart' show RenderObject, RenderBox, debugDumpR // KEYS /// A key that is only equal to itself. +/// +/// This cannot be created with a const constructor because that implies that +/// all instantiated keys would be the same instance and therefore not be unique. class UniqueKey extends LocalKey { /// Creates a key that is equal only to itself. + /// + /// The key cannot be created with a const constructor because that implies + /// that all instantiated keys would be the same instance and therefore not + /// be unique. // ignore: prefer_const_constructors_in_immutables , never use const for this class UniqueKey();