Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
286c9751
Unverified
Commit
286c9751
authored
Feb 16, 2022
by
chunhtai
Committed by
GitHub
Feb 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add explanation to ChangeNotifier (#98295)
parent
b42438fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
change_notifier.dart
packages/flutter/lib/src/foundation/change_notifier.dart
+7
-3
No files found.
packages/flutter/lib/src/foundation/change_notifier.dart
View file @
286c9751
...
@@ -104,9 +104,13 @@ abstract class ValueListenable<T> extends Listenable {
...
@@ -104,9 +104,13 @@ abstract class ValueListenable<T> extends Listenable {
class
ChangeNotifier
implements
Listenable
{
class
ChangeNotifier
implements
Listenable
{
int
_count
=
0
;
int
_count
=
0
;
// The _listeners is intentionally set to a fixed-length _GrowableList instead
// The _listeners is intentionally set to a fixed-length _GrowableList instead
// of const [] for performance reasons.
// of const [].
// See https://github.com/flutter/flutter/pull/71947/files#r545722476 for
//
// more details.
// 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
<
VoidCallback
?>
_emptyListeners
=
List
<
VoidCallback
?>.
filled
(
0
,
null
);
static
final
List
<
VoidCallback
?>
_emptyListeners
=
List
<
VoidCallback
?>.
filled
(
0
,
null
);
List
<
VoidCallback
?>
_listeners
=
_emptyListeners
;
List
<
VoidCallback
?>
_listeners
=
_emptyListeners
;
int
_notificationCallStackDepth
=
0
;
int
_notificationCallStackDepth
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment