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
afa37891
Unverified
Commit
afa37891
authored
Aug 24, 2023
by
Polina Cherkasova
Committed by
GitHub
Aug 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Users of ChangeNotifier should dispatch event of object creation in constructor. (#133210)
parent
8175d693
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
72 additions
and
4 deletions
+72
-4
navigator.dart
packages/flutter/lib/src/widgets/navigator.dart
+7
-0
selectable_region.dart
packages/flutter/lib/src/widgets/selectable_region.dart
+7
-0
widget_inspector.dart
packages/flutter/lib/src/widgets/widget_inspector.dart
+7
-0
change_notifier_test.dart
packages/flutter/test/foundation/change_notifier_test.dart
+12
-0
automatic_keep_alive_test.dart
packages/flutter/test/widgets/automatic_keep_alive_test.dart
+7
-0
route_notification_messages_test.dart
...lutter/test/widgets/route_notification_messages_test.dart
+5
-1
router_restoration_test.dart
packages/flutter/test/widgets/router_restoration_test.dart
+12
-0
router_test.dart
packages/flutter/test/widgets/router_test.dart
+15
-3
No files found.
packages/flutter/lib/src/widgets/navigator.dart
View file @
afa37891
...
@@ -3355,6 +3355,13 @@ typedef _IndexWhereCallback = bool Function(_RouteEntry element);
...
@@ -3355,6 +3355,13 @@ typedef _IndexWhereCallback = bool Function(_RouteEntry element);
/// Acts as a ChangeNotifier and notifies after its List of _RouteEntries is
/// Acts as a ChangeNotifier and notifies after its List of _RouteEntries is
/// mutated.
/// mutated.
class
_History
extends
Iterable
<
_RouteEntry
>
with
ChangeNotifier
{
class
_History
extends
Iterable
<
_RouteEntry
>
with
ChangeNotifier
{
/// Creates an instance of [_History].
_History
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
final
List
<
_RouteEntry
>
_value
=
<
_RouteEntry
>[];
final
List
<
_RouteEntry
>
_value
=
<
_RouteEntry
>[];
int
indexWhere
(
_IndexWhereCallback
test
,
[
int
start
=
0
])
{
int
indexWhere
(
_IndexWhereCallback
test
,
[
int
start
=
0
])
{
...
...
packages/flutter/lib/src/widgets/selectable_region.dart
View file @
afa37891
...
@@ -1567,6 +1567,13 @@ class _SelectableRegionContainerDelegate extends MultiSelectableSelectionContain
...
@@ -1567,6 +1567,13 @@ class _SelectableRegionContainerDelegate extends MultiSelectableSelectionContain
/// This class optimize the selection update by keeping track of the
/// This class optimize the selection update by keeping track of the
/// [Selectable]s that currently contain the selection edges.
/// [Selectable]s that currently contain the selection edges.
abstract
class
MultiSelectableSelectionContainerDelegate
extends
SelectionContainerDelegate
with
ChangeNotifier
{
abstract
class
MultiSelectableSelectionContainerDelegate
extends
SelectionContainerDelegate
with
ChangeNotifier
{
/// Creates an instance of [MultiSelectableSelectionContainerDelegate].
MultiSelectableSelectionContainerDelegate
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
/// Gets the list of selectables this delegate is managing.
/// Gets the list of selectables this delegate is managing.
List
<
Selectable
>
selectables
=
<
Selectable
>[];
List
<
Selectable
>
selectables
=
<
Selectable
>[];
...
...
packages/flutter/lib/src/widgets/widget_inspector.dart
View file @
afa37891
...
@@ -2895,6 +2895,13 @@ class _WidgetInspectorState extends State<WidgetInspector>
...
@@ -2895,6 +2895,13 @@ class _WidgetInspectorState extends State<WidgetInspector>
/// Mutable selection state of the inspector.
/// Mutable selection state of the inspector.
class
InspectorSelection
with
ChangeNotifier
{
class
InspectorSelection
with
ChangeNotifier
{
/// Creates an instance of [InspectorSelection].
InspectorSelection
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
/// Render objects that are candidates to be selected.
/// Render objects that are candidates to be selected.
///
///
/// Tools may wish to iterate through the list of candidates.
/// Tools may wish to iterate through the list of candidates.
...
...
packages/flutter/test/foundation/change_notifier_test.dart
View file @
afa37891
...
@@ -27,6 +27,12 @@ class A {
...
@@ -27,6 +27,12 @@ class A {
}
}
class
B
extends
A
with
ChangeNotifier
{
class
B
extends
A
with
ChangeNotifier
{
B
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
@override
@override
void
test
()
{
void
test
()
{
notifyListeners
();
notifyListeners
();
...
@@ -35,6 +41,12 @@ class B extends A with ChangeNotifier {
...
@@ -35,6 +41,12 @@ class B extends A with ChangeNotifier {
}
}
class
Counter
with
ChangeNotifier
{
class
Counter
with
ChangeNotifier
{
Counter
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
int
get
value
=>
_value
;
int
get
value
=>
_value
;
int
_value
=
0
;
int
_value
=
0
;
set
value
(
int
value
)
{
set
value
(
int
value
)
{
...
...
packages/flutter/test/widgets/automatic_keep_alive_test.dart
View file @
afa37891
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
show
DragStartBehavior
;
import
'package:flutter/gestures.dart'
show
DragStartBehavior
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -631,6 +632,12 @@ class RenderSliverMultiBoxAdaptorAlt extends RenderSliver with
...
@@ -631,6 +632,12 @@ class RenderSliverMultiBoxAdaptorAlt extends RenderSliver with
}
}
class
LeakCheckerHandle
with
ChangeNotifier
{
class
LeakCheckerHandle
with
ChangeNotifier
{
LeakCheckerHandle
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
@override
@override
bool
get
hasListeners
=>
super
.
hasListeners
;
bool
get
hasListeners
=>
super
.
hasListeners
;
}
}
...
...
packages/flutter/test/widgets/route_notification_messages_test.dart
View file @
afa37891
...
@@ -338,7 +338,11 @@ class SimpleRouterDelegate extends RouterDelegate<RouteInformation> with ChangeN
...
@@ -338,7 +338,11 @@ class SimpleRouterDelegate extends RouterDelegate<RouteInformation> with ChangeN
required
this
.
builder
,
required
this
.
builder
,
this
.
onPopRoute
,
this
.
onPopRoute
,
this
.
reportConfiguration
=
false
,
this
.
reportConfiguration
=
false
,
});
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
RouteInformation
get
routeInformation
=>
_routeInformation
;
RouteInformation
get
routeInformation
=>
_routeInformation
;
late
RouteInformation
_routeInformation
;
late
RouteInformation
_routeInformation
;
...
...
packages/flutter/test/widgets/router_restoration_test.dart
View file @
afa37891
...
@@ -90,6 +90,12 @@ class _TestRouteInformationParser extends RouteInformationParser<String> {
...
@@ -90,6 +90,12 @@ class _TestRouteInformationParser extends RouteInformationParser<String> {
}
}
class
_TestRouterDelegate
extends
RouterDelegate
<
String
>
with
ChangeNotifier
{
class
_TestRouterDelegate
extends
RouterDelegate
<
String
>
with
ChangeNotifier
{
_TestRouterDelegate
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
final
List
<
String
>
newRoutePaths
=
<
String
>[];
final
List
<
String
>
newRoutePaths
=
<
String
>[];
final
List
<
String
>
restoredRoutePaths
=
<
String
>[];
final
List
<
String
>
restoredRoutePaths
=
<
String
>[];
...
@@ -128,6 +134,12 @@ class _TestRouterDelegate extends RouterDelegate<String> with ChangeNotifier {
...
@@ -128,6 +134,12 @@ class _TestRouterDelegate extends RouterDelegate<String> with ChangeNotifier {
}
}
class
_TestRouteInformationProvider
extends
RouteInformationProvider
with
ChangeNotifier
{
class
_TestRouteInformationProvider
extends
RouteInformationProvider
with
ChangeNotifier
{
_TestRouteInformationProvider
()
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
@override
@override
RouteInformation
get
value
=>
_value
;
RouteInformation
get
value
=>
_value
;
RouteInformation
_value
=
RouteInformation
(
uri:
Uri
.
parse
(
'/home'
));
RouteInformation
_value
=
RouteInformation
(
uri:
Uri
.
parse
(
'/home'
));
...
...
packages/flutter/test/widgets/router_test.dart
View file @
afa37891
...
@@ -1633,7 +1633,11 @@ class SimpleRouterDelegate extends RouterDelegate<RouteInformation> with ChangeN
...
@@ -1633,7 +1633,11 @@ class SimpleRouterDelegate extends RouterDelegate<RouteInformation> with ChangeN
this
.
builder
,
this
.
builder
,
this
.
onPopRoute
,
this
.
onPopRoute
,
this
.
reportConfiguration
=
false
,
this
.
reportConfiguration
=
false
,
});
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
RouteInformation
?
get
routeInformation
=>
_routeInformation
;
RouteInformation
?
get
routeInformation
=>
_routeInformation
;
RouteInformation
?
_routeInformation
;
RouteInformation
?
_routeInformation
;
...
@@ -1717,7 +1721,11 @@ class SimpleNavigatorRouterDelegate extends RouterDelegate<RouteInformation> wit
...
@@ -1717,7 +1721,11 @@ class SimpleNavigatorRouterDelegate extends RouterDelegate<RouteInformation> wit
class
SimpleRouteInformationProvider
extends
RouteInformationProvider
with
ChangeNotifier
{
class
SimpleRouteInformationProvider
extends
RouteInformationProvider
with
ChangeNotifier
{
SimpleRouteInformationProvider
({
SimpleRouteInformationProvider
({
this
.
onRouterReport
,
this
.
onRouterReport
,
});
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
RouterReportRouterInformation
?
onRouterReport
;
RouterReportRouterInformation
?
onRouterReport
;
...
@@ -1773,7 +1781,11 @@ class CompleterRouteInformationParser extends RouteInformationParser<RouteInform
...
@@ -1773,7 +1781,11 @@ class CompleterRouteInformationParser extends RouteInformationParser<RouteInform
class
SimpleAsyncRouterDelegate
extends
RouterDelegate
<
RouteInformation
>
with
ChangeNotifier
{
class
SimpleAsyncRouterDelegate
extends
RouterDelegate
<
RouteInformation
>
with
ChangeNotifier
{
SimpleAsyncRouterDelegate
({
SimpleAsyncRouterDelegate
({
required
this
.
builder
,
required
this
.
builder
,
});
})
{
if
(
kFlutterMemoryAllocationsEnabled
)
{
maybeDispatchObjectCreation
();
}
}
RouteInformation
?
get
routeInformation
=>
_routeInformation
;
RouteInformation
?
get
routeInformation
=>
_routeInformation
;
RouteInformation
?
_routeInformation
;
RouteInformation
?
_routeInformation
;
...
...
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