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
5c6ef59b
Unverified
Commit
5c6ef59b
authored
Sep 18, 2023
by
Polina Cherkasova
Committed by
GitHub
Sep 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve breaking change of adding a method to ChangeNotifier. (#134953)
parent
f2050e8a
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
30 additions
and
34 deletions
+30
-34
change_notifier.dart
packages/flutter/lib/src/foundation/change_notifier.dart
+7
-7
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+1
-1
restoration.dart
packages/flutter/lib/src/services/restoration.dart
+1
-1
draggable_scrollable_sheet.dart
...s/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
+1
-1
focus_manager.dart
packages/flutter/lib/src/widgets/focus_manager.dart
+2
-2
focus_traversal.dart
packages/flutter/lib/src/widgets/focus_traversal.dart
+1
-1
navigator.dart
packages/flutter/lib/src/widgets/navigator.dart
+1
-1
restoration.dart
packages/flutter/lib/src/widgets/restoration.dart
+1
-1
router.dart
packages/flutter/lib/src/widgets/router.dart
+1
-1
scroll_controller.dart
packages/flutter/lib/src/widgets/scroll_controller.dart
+1
-1
selectable_region.dart
packages/flutter/lib/src/widgets/selectable_region.dart
+1
-1
shortcuts.dart
packages/flutter/lib/src/widgets/shortcuts.dart
+2
-2
snapshot_widget.dart
packages/flutter/lib/src/widgets/snapshot_widget.dart
+0
-4
widget_inspector.dart
packages/flutter/lib/src/widgets/widget_inspector.dart
+1
-1
change_notifier_test.dart
packages/flutter/test/foundation/change_notifier_test.dart
+2
-2
automatic_keep_alive_test.dart
packages/flutter/test/widgets/automatic_keep_alive_test.dart
+1
-1
route_notification_messages_test.dart
...lutter/test/widgets/route_notification_messages_test.dart
+1
-1
router_restoration_test.dart
packages/flutter/test/widgets/router_restoration_test.dart
+2
-2
router_test.dart
packages/flutter/test/widgets/router_test.dart
+3
-3
No files found.
packages/flutter/lib/src/foundation/change_notifier.dart
View file @
5c6ef59b
...
@@ -207,7 +207,7 @@ mixin class ChangeNotifier implements Listenable {
...
@@ -207,7 +207,7 @@ mixin class ChangeNotifier implements Listenable {
@protected
@protected
bool
get
hasListeners
=>
_count
>
0
;
bool
get
hasListeners
=>
_count
>
0
;
/// Dispatches event of
object
creation to [MemoryAllocations.instance].
/// Dispatches event of
the [object]
creation to [MemoryAllocations.instance].
///
///
/// If the event was already dispatched or [kFlutterMemoryAllocationsEnabled]
/// If the event was already dispatched or [kFlutterMemoryAllocationsEnabled]
/// is false, the method is noop.
/// is false, the method is noop.
...
@@ -227,16 +227,16 @@ mixin class ChangeNotifier implements Listenable {
...
@@ -227,16 +227,16 @@ mixin class ChangeNotifier implements Listenable {
/// Make sure to invoke it with condition `if (kFlutterMemoryAllocationsEnabled) ...`
/// Make sure to invoke it with condition `if (kFlutterMemoryAllocationsEnabled) ...`
/// so that the method is tree-shaken away when the flag is false.
/// so that the method is tree-shaken away when the flag is false.
@protected
@protected
void
maybeDispatchObjectCreation
(
)
{
static
void
maybeDispatchObjectCreation
(
ChangeNotifier
object
)
{
// Tree shaker does not include this method and the class MemoryAllocations
// Tree shaker does not include this method and the class MemoryAllocations
// if kFlutterMemoryAllocationsEnabled is false.
// if kFlutterMemoryAllocationsEnabled is false.
if
(
kFlutterMemoryAllocationsEnabled
&&
!
_creationDispatched
)
{
if
(
kFlutterMemoryAllocationsEnabled
&&
!
object
.
_creationDispatched
)
{
MemoryAllocations
.
instance
.
dispatchObjectCreated
(
MemoryAllocations
.
instance
.
dispatchObjectCreated
(
library
:
_flutterFoundationLibrary
,
library
:
_flutterFoundationLibrary
,
className:
'
$ChangeNotifier
'
,
className:
'
$ChangeNotifier
'
,
object:
this
,
object:
object
,
);
);
_creationDispatched
=
true
;
object
.
_creationDispatched
=
true
;
}
}
}
}
...
@@ -271,7 +271,7 @@ mixin class ChangeNotifier implements Listenable {
...
@@ -271,7 +271,7 @@ mixin class ChangeNotifier implements Listenable {
assert
(
ChangeNotifier
.
debugAssertNotDisposed
(
this
));
assert
(
ChangeNotifier
.
debugAssertNotDisposed
(
this
));
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
maybeDispatchObjectCreation
(
this
);
}
}
if
(
_count
==
_listeners
.
length
)
{
if
(
_count
==
_listeners
.
length
)
{
...
@@ -535,7 +535,7 @@ class ValueNotifier<T> extends ChangeNotifier implements ValueListenable<T> {
...
@@ -535,7 +535,7 @@ class ValueNotifier<T> extends ChangeNotifier implements ValueListenable<T> {
/// Creates a [ChangeNotifier] that wraps this value.
/// Creates a [ChangeNotifier] that wraps this value.
ValueNotifier
(
this
.
_value
)
{
ValueNotifier
(
this
.
_value
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/lib/src/rendering/paragraph.dart
View file @
5c6ef59b
...
@@ -1321,7 +1321,7 @@ class _SelectableFragment with Selectable, ChangeNotifier implements TextLayoutM
...
@@ -1321,7 +1321,7 @@ class _SelectableFragment with Selectable, ChangeNotifier implements TextLayoutM
required
this
.
range
,
required
this
.
range
,
})
:
assert
(
range
.
isValid
&&
!
range
.
isCollapsed
&&
range
.
isNormalized
)
{
})
:
assert
(
range
.
isValid
&&
!
range
.
isCollapsed
&&
range
.
isNormalized
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
_selectionGeometry
=
_getSelectionGeometry
();
_selectionGeometry
=
_getSelectionGeometry
();
}
}
...
...
packages/flutter/lib/src/services/restoration.dart
View file @
5c6ef59b
...
@@ -155,7 +155,7 @@ class RestorationManager extends ChangeNotifier {
...
@@ -155,7 +155,7 @@ class RestorationManager extends ChangeNotifier {
/// with the engine to get restoration messages (by calling [initChannels]).
/// with the engine to get restoration messages (by calling [initChannels]).
RestorationManager
()
{
RestorationManager
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
initChannels
();
initChannels
();
}
}
...
...
packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
View file @
5c6ef59b
...
@@ -1074,7 +1074,7 @@ class _DraggableScrollableActuatorState extends State<DraggableScrollableActuato
...
@@ -1074,7 +1074,7 @@ class _DraggableScrollableActuatorState extends State<DraggableScrollableActuato
class
_ResetNotifier
extends
ChangeNotifier
{
class
_ResetNotifier
extends
ChangeNotifier
{
_ResetNotifier
()
{
_ResetNotifier
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
/// Whether someone called [sendReset] or not.
/// Whether someone called [sendReset] or not.
...
...
packages/flutter/lib/src/widgets/focus_manager.dart
View file @
5c6ef59b
...
@@ -439,7 +439,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
...
@@ -439,7 +439,7 @@ class FocusNode with DiagnosticableTreeMixin, ChangeNotifier {
this
.
debugLabel
=
debugLabel
;
this
.
debugLabel
=
debugLabel
;
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
@@ -1468,7 +1468,7 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
...
@@ -1468,7 +1468,7 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
/// documentation in that method for caveats to watch out for.
/// documentation in that method for caveats to watch out for.
FocusManager
()
{
FocusManager
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
rootScope
.
_manager
=
this
;
rootScope
.
_manager
=
this
;
}
}
...
...
packages/flutter/lib/src/widgets/focus_traversal.dart
View file @
5c6ef59b
...
@@ -1788,7 +1788,7 @@ class _FocusTraversalGroupNode extends FocusNode {
...
@@ -1788,7 +1788,7 @@ class _FocusTraversalGroupNode extends FocusNode {
required
this
.
policy
,
required
this
.
policy
,
})
{
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/lib/src/widgets/navigator.dart
View file @
5c6ef59b
...
@@ -3390,7 +3390,7 @@ class _History extends Iterable<_RouteEntry> with ChangeNotifier {
...
@@ -3390,7 +3390,7 @@ class _History extends Iterable<_RouteEntry> with ChangeNotifier {
/// Creates an instance of [_History].
/// Creates an instance of [_History].
_History
()
{
_History
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/lib/src/widgets/restoration.dart
View file @
5c6ef59b
...
@@ -457,7 +457,7 @@ abstract class RestorableProperty<T> extends ChangeNotifier {
...
@@ -457,7 +457,7 @@ abstract class RestorableProperty<T> extends ChangeNotifier {
/// Creates a [RestorableProperty].
/// Creates a [RestorableProperty].
RestorableProperty
(){
RestorableProperty
(){
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/lib/src/widgets/router.dart
View file @
5c6ef59b
...
@@ -1467,7 +1467,7 @@ class PlatformRouteInformationProvider extends RouteInformationProvider with Wid
...
@@ -1467,7 +1467,7 @@ class PlatformRouteInformationProvider extends RouteInformationProvider with Wid
required
RouteInformation
initialRouteInformation
,
required
RouteInformation
initialRouteInformation
,
})
:
_value
=
initialRouteInformation
{
})
:
_value
=
initialRouteInformation
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/lib/src/widgets/scroll_controller.dart
View file @
5c6ef59b
...
@@ -65,7 +65,7 @@ class ScrollController extends ChangeNotifier {
...
@@ -65,7 +65,7 @@ class ScrollController extends ChangeNotifier {
this
.
onDetach
,
this
.
onDetach
,
})
:
_initialScrollOffset
=
initialScrollOffset
{
})
:
_initialScrollOffset
=
initialScrollOffset
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/lib/src/widgets/selectable_region.dart
View file @
5c6ef59b
...
@@ -1580,7 +1580,7 @@ abstract class MultiSelectableSelectionContainerDelegate extends SelectionContai
...
@@ -1580,7 +1580,7 @@ abstract class MultiSelectableSelectionContainerDelegate extends SelectionContai
/// Creates an instance of [MultiSelectableSelectionContainerDelegate].
/// Creates an instance of [MultiSelectableSelectionContainerDelegate].
MultiSelectableSelectionContainerDelegate
()
{
MultiSelectableSelectionContainerDelegate
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/lib/src/widgets/shortcuts.dart
View file @
5c6ef59b
...
@@ -749,7 +749,7 @@ class ShortcutManager with Diagnosticable, ChangeNotifier {
...
@@ -749,7 +749,7 @@ class ShortcutManager with Diagnosticable, ChangeNotifier {
this
.
modal
=
false
,
this
.
modal
=
false
,
})
:
_shortcuts
=
shortcuts
{
})
:
_shortcuts
=
shortcuts
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
@@ -1203,7 +1203,7 @@ class ShortcutRegistry with ChangeNotifier {
...
@@ -1203,7 +1203,7 @@ class ShortcutRegistry with ChangeNotifier {
/// Creates an instance of [ShortcutRegistry].
/// Creates an instance of [ShortcutRegistry].
ShortcutRegistry
()
{
ShortcutRegistry
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/lib/src/widgets/snapshot_widget.dart
View file @
5c6ef59b
...
@@ -482,8 +482,4 @@ class _DefaultSnapshotPainter implements SnapshotPainter {
...
@@ -482,8 +482,4 @@ class _DefaultSnapshotPainter implements SnapshotPainter {
@override
@override
bool
shouldRepaint
(
covariant
_DefaultSnapshotPainter
oldPainter
)
=>
false
;
bool
shouldRepaint
(
covariant
_DefaultSnapshotPainter
oldPainter
)
=>
false
;
@override
@protected
void
maybeDispatchObjectCreation
()
{
}
}
}
packages/flutter/lib/src/widgets/widget_inspector.dart
View file @
5c6ef59b
...
@@ -2898,7 +2898,7 @@ class InspectorSelection with ChangeNotifier {
...
@@ -2898,7 +2898,7 @@ class InspectorSelection with ChangeNotifier {
/// Creates an instance of [InspectorSelection].
/// Creates an instance of [InspectorSelection].
InspectorSelection
()
{
InspectorSelection
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/test/foundation/change_notifier_test.dart
View file @
5c6ef59b
...
@@ -29,7 +29,7 @@ class A {
...
@@ -29,7 +29,7 @@ class A {
class
B
extends
A
with
ChangeNotifier
{
class
B
extends
A
with
ChangeNotifier
{
B
()
{
B
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
@@ -43,7 +43,7 @@ class B extends A with ChangeNotifier {
...
@@ -43,7 +43,7 @@ class B extends A with ChangeNotifier {
class
Counter
with
ChangeNotifier
{
class
Counter
with
ChangeNotifier
{
Counter
()
{
Counter
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/test/widgets/automatic_keep_alive_test.dart
View file @
5c6ef59b
...
@@ -638,7 +638,7 @@ class RenderSliverMultiBoxAdaptorAlt extends RenderSliver with
...
@@ -638,7 +638,7 @@ class RenderSliverMultiBoxAdaptorAlt extends RenderSliver with
class
LeakCheckerHandle
with
ChangeNotifier
{
class
LeakCheckerHandle
with
ChangeNotifier
{
LeakCheckerHandle
()
{
LeakCheckerHandle
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/test/widgets/route_notification_messages_test.dart
View file @
5c6ef59b
...
@@ -340,7 +340,7 @@ class SimpleRouterDelegate extends RouterDelegate<RouteInformation> with ChangeN
...
@@ -340,7 +340,7 @@ class SimpleRouterDelegate extends RouterDelegate<RouteInformation> with ChangeN
this
.
reportConfiguration
=
false
,
this
.
reportConfiguration
=
false
,
})
{
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/test/widgets/router_restoration_test.dart
View file @
5c6ef59b
...
@@ -92,7 +92,7 @@ class _TestRouteInformationParser extends RouteInformationParser<String> {
...
@@ -92,7 +92,7 @@ class _TestRouteInformationParser extends RouteInformationParser<String> {
class
_TestRouterDelegate
extends
RouterDelegate
<
String
>
with
ChangeNotifier
{
class
_TestRouterDelegate
extends
RouterDelegate
<
String
>
with
ChangeNotifier
{
_TestRouterDelegate
()
{
_TestRouterDelegate
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
@@ -136,7 +136,7 @@ class _TestRouterDelegate extends RouterDelegate<String> with ChangeNotifier {
...
@@ -136,7 +136,7 @@ class _TestRouterDelegate extends RouterDelegate<String> with ChangeNotifier {
class
_TestRouteInformationProvider
extends
RouteInformationProvider
with
ChangeNotifier
{
class
_TestRouteInformationProvider
extends
RouteInformationProvider
with
ChangeNotifier
{
_TestRouteInformationProvider
()
{
_TestRouteInformationProvider
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
packages/flutter/test/widgets/router_test.dart
View file @
5c6ef59b
...
@@ -1646,7 +1646,7 @@ class SimpleRouterDelegate extends RouterDelegate<RouteInformation> with ChangeN
...
@@ -1646,7 +1646,7 @@ class SimpleRouterDelegate extends RouterDelegate<RouteInformation> with ChangeN
this
.
reportConfiguration
=
false
,
this
.
reportConfiguration
=
false
,
})
{
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
@@ -1734,7 +1734,7 @@ class SimpleRouteInformationProvider extends RouteInformationProvider with Chang
...
@@ -1734,7 +1734,7 @@ class SimpleRouteInformationProvider extends RouteInformationProvider with Chang
this
.
onRouterReport
,
this
.
onRouterReport
,
})
{
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
@@ -1794,7 +1794,7 @@ class SimpleAsyncRouterDelegate extends RouterDelegate<RouteInformation> with Ch
...
@@ -1794,7 +1794,7 @@ class SimpleAsyncRouterDelegate extends RouterDelegate<RouteInformation> with Ch
required
this
.
builder
,
required
this
.
builder
,
})
{
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
(
);
ChangeNotifier
.
maybeDispatchObjectCreation
(
this
);
}
}
}
}
...
...
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