Retain the toString method for subclasses of Key in profile/release mode (#149926)

toString methods are removed in AOT builds by the optimization in https://github.com/flutter/flutter/pull/144763

This PR disables that for Key subclasses because some applications rely on the previous behavior.

Fixes https://github.com/flutter/flutter/issues/148983
This commit is contained in:
Jason Simmons
2024-06-10 09:06:02 -07:00
committed by GitHub
parent 2d0a0237d2
commit 4e6e61dfd5
2 changed files with 9 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import 'diagnostics.dart';
///
/// * [Widget.key], which discusses how widgets use keys.
@immutable
@pragma('flutter:keep-to-string-in-subtypes')
abstract class Key {
/// Construct a [ValueKey<String>] with the given [String].
///