diff --git a/packages/flutter/lib/src/foundation/change_notifier.dart b/packages/flutter/lib/src/foundation/change_notifier.dart index 5f45282deb..d3b521f7d3 100644 --- a/packages/flutter/lib/src/foundation/change_notifier.dart +++ b/packages/flutter/lib/src/foundation/change_notifier.dart @@ -104,9 +104,13 @@ abstract class ValueListenable extends Listenable { class ChangeNotifier implements Listenable { int _count = 0; // The _listeners is intentionally set to a fixed-length _GrowableList instead - // of const [] for performance reasons. - // See https://github.com/flutter/flutter/pull/71947/files#r545722476 for - // more details. + // of const []. + // + // The const [] creates an instance of _ImmutableList which would be + // different from fixed-length _GrowableList used elsewhere in this class. + // keeping runtime type the same during the lifetime of this class lets the + // compiler to infer concrete type for this property, and thus improves + // performance. static final List _emptyListeners = List.filled(0, null); List _listeners = _emptyListeners; int _notificationCallStackDepth = 0;