File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/flutter/lib/src/foundation Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -104,9 +104,13 @@ abstract class ValueListenable<T> extends Listenable {
104104class ChangeNotifier implements Listenable {
105105 int _count = 0 ;
106106 // The _listeners is intentionally set to a fixed-length _GrowableList instead
107- // of const [] for performance reasons.
108- // See https://github.com/flutter/flutter/pull/71947/files#r545722476 for
109- // more details.
107+ // of const [].
108+ //
109+ // The const [] creates an instance of _ImmutableList which would be
110+ // different from fixed-length _GrowableList used elsewhere in this class.
111+ // keeping runtime type the same during the lifetime of this class lets the
112+ // compiler to infer concrete type for this property, and thus improves
113+ // performance.
110114 static final List <VoidCallback ?> _emptyListeners = List <VoidCallback ?>.filled (0 , null );
111115 List <VoidCallback ?> _listeners = _emptyListeners;
112116 int _notificationCallStackDepth = 0 ;
You can’t perform that action at this time.
0 commit comments