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
12a2e682
Unverified
Commit
12a2e682
authored
Apr 21, 2021
by
xubaolin
Committed by
GitHub
Apr 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace some `dynamic` to `Object?` type (#80772)
parent
07a6b8f0
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
146 deletions
+146
-146
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+2
-2
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+1
-1
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+3
-3
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+13
-13
navigator.dart
packages/flutter/lib/src/widgets/navigator.dart
+106
-106
routes.dart
packages/flutter/lib/src/widgets/routes.dart
+20
-20
will_pop_scope.dart
packages/flutter/lib/src/widgets/will_pop_scope.dart
+1
-1
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
12a2e682
...
...
@@ -789,7 +789,7 @@ class _AppBarState extends State<AppBar> {
final
ColorScheme
colorScheme
=
theme
.
colorScheme
;
final
AppBarTheme
appBarTheme
=
AppBarTheme
.
of
(
context
);
final
ScaffoldState
?
scaffold
=
Scaffold
.
maybeOf
(
context
);
final
ModalRoute
<
dynamic
>?
parentRoute
=
ModalRoute
.
of
(
context
);
final
ModalRoute
<
Object
?
>?
parentRoute
=
ModalRoute
.
of
(
context
);
final
FlexibleSpaceBarSettings
?
settings
=
context
.
dependOnInheritedWidgetOfExactType
<
FlexibleSpaceBarSettings
>();
final
Set
<
MaterialState
>
states
=
<
MaterialState
>{
...
...
@@ -799,7 +799,7 @@ class _AppBarState extends State<AppBar> {
final
bool
hasDrawer
=
scaffold
?.
hasDrawer
??
false
;
final
bool
hasEndDrawer
=
scaffold
?.
hasEndDrawer
??
false
;
final
bool
canPop
=
parentRoute
?.
canPop
??
false
;
final
bool
useCloseButton
=
parentRoute
is
PageRoute
<
dynamic
>
&&
parentRoute
.
fullscreenDialog
;
final
bool
useCloseButton
=
parentRoute
is
PageRoute
<
Object
?
>
&&
parentRoute
.
fullscreenDialog
;
final
double
toolbarHeight
=
widget
.
toolbarHeight
??
appBarTheme
.
toolbarHeight
??
kToolbarHeight
;
final
bool
backwardsCompatibility
=
widget
.
backwardsCompatibility
??
appBarTheme
.
backwardsCompatibility
??
true
;
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
12a2e682
...
...
@@ -363,7 +363,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
void
_ensureHistoryEntry
()
{
if
(
_historyEntry
==
null
)
{
final
ModalRoute
<
dynamic
>?
route
=
ModalRoute
.
of
(
context
);
final
ModalRoute
<
Object
?
>?
route
=
ModalRoute
.
of
(
context
);
if
(
route
!=
null
)
{
_historyEntry
=
LocalHistoryEntry
(
onRemove:
_handleHistoryEntryRemoved
);
route
.
addLocalHistoryEntry
(
_historyEntry
!);
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
12a2e682
...
...
@@ -452,7 +452,7 @@ class ScaffoldMessengerState extends State<ScaffoldMessenger> with TickerProvide
_accessibleNavigation
=
mediaQuery
.
accessibleNavigation
;
if
(
_snackBars
.
isNotEmpty
)
{
final
ModalRoute
<
dynamic
>?
route
=
ModalRoute
.
of
(
context
);
final
ModalRoute
<
Object
?
>?
route
=
ModalRoute
.
of
(
context
);
if
(
route
==
null
||
route
.
isCurrent
)
{
if
(
_snackBarController
!.
isCompleted
&&
_snackBarTimer
==
null
)
{
final
SnackBar
snackBar
=
_snackBars
.
first
.
_widget
;
...
...
@@ -2408,7 +2408,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
// Important if the app/user takes an action that could repeatedly show a
// bottom sheet.
final
List
<
_StandardBottomSheet
>
_dismissedBottomSheets
=
<
_StandardBottomSheet
>[];
PersistentBottomSheetController
<
dynamic
>?
_currentBottomSheet
;
PersistentBottomSheetController
<
Object
?
>?
_currentBottomSheet
;
final
GlobalKey
_currentBottomSheetKey
=
GlobalKey
();
void
_maybeBuildPersistentBottomSheet
()
{
...
...
@@ -2981,7 +2981,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
// TODO(Piinks): Remove old SnackBar API after migrating ScaffoldMessenger
_accessibleNavigation
=
mediaQuery
.
accessibleNavigation
;
if
(
_snackBars
.
isNotEmpty
)
{
final
ModalRoute
<
dynamic
>?
route
=
ModalRoute
.
of
(
context
);
final
ModalRoute
<
Object
?
>?
route
=
ModalRoute
.
of
(
context
);
if
(
route
==
null
||
route
.
isCurrent
)
{
if
(
_snackBarController
!.
isCompleted
&&
_snackBarTimer
==
null
)
{
final
SnackBar
snackBar
=
_snackBars
.
first
.
_widget
;
...
...
packages/flutter/lib/src/widgets/heroes.dart
View file @
12a2e682
...
...
@@ -487,8 +487,8 @@ class _HeroFlightManifest {
final
HeroFlightDirection
type
;
final
OverlayState
overlay
;
final
Size
navigatorSize
;
final
PageRoute
<
dynamic
>
fromRoute
;
final
PageRoute
<
dynamic
>
toRoute
;
final
PageRoute
<
Object
?
>
fromRoute
;
final
PageRoute
<
Object
?
>
toRoute
;
final
_HeroState
fromHero
;
final
_HeroState
toHero
;
final
CreateRectTween
?
createRectTween
;
...
...
@@ -830,14 +830,14 @@ class HeroController extends NavigatorObserver {
final
Map
<
Object
,
_HeroFlight
>
_flights
=
<
Object
,
_HeroFlight
>{};
@override
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>?
previousRoute
)
{
void
didPush
(
Route
<
Object
?>
route
,
Route
<
Object
?
>?
previousRoute
)
{
assert
(
navigator
!=
null
);
assert
(
route
!=
null
);
_maybeStartHeroTransition
(
previousRoute
,
route
,
HeroFlightDirection
.
push
,
false
);
}
@override
void
didPop
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>?
previousRoute
)
{
void
didPop
(
Route
<
Object
?>
route
,
Route
<
Object
?
>?
previousRoute
)
{
assert
(
navigator
!=
null
);
assert
(
route
!=
null
);
// Don't trigger another flight when a pop is committed as a user gesture
...
...
@@ -847,7 +847,7 @@ class HeroController extends NavigatorObserver {
}
@override
void
didReplace
({
Route
<
dynamic
>?
newRoute
,
Route
<
dynamic
>?
oldRoute
})
{
void
didReplace
({
Route
<
Object
?>?
newRoute
,
Route
<
Object
?
>?
oldRoute
})
{
assert
(
navigator
!=
null
);
if
(
newRoute
?.
isCurrent
==
true
)
{
// Only run hero animations if the top-most route got replaced.
...
...
@@ -856,7 +856,7 @@ class HeroController extends NavigatorObserver {
}
@override
void
didStartUserGesture
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>?
previousRoute
)
{
void
didStartUserGesture
(
Route
<
Object
?>
route
,
Route
<
Object
?
>?
previousRoute
)
{
assert
(
navigator
!=
null
);
assert
(
route
!=
null
);
_maybeStartHeroTransition
(
route
,
previousRoute
,
HeroFlightDirection
.
pop
,
true
);
...
...
@@ -892,14 +892,14 @@ class HeroController extends NavigatorObserver {
// If we're transitioning between different page routes, start a hero transition
// after the toRoute has been laid out with its animation's value at 1.0.
void
_maybeStartHeroTransition
(
Route
<
dynamic
>?
fromRoute
,
Route
<
dynamic
>?
toRoute
,
Route
<
Object
?
>?
fromRoute
,
Route
<
Object
?
>?
toRoute
,
HeroFlightDirection
flightType
,
bool
isUserGestureTransition
,
)
{
if
(
toRoute
!=
fromRoute
&&
toRoute
is
PageRoute
<
dynamic
>
&&
fromRoute
is
PageRoute
<
dynamic
>)
{
final
PageRoute
<
dynamic
>
from
=
fromRoute
;
final
PageRoute
<
dynamic
>
to
=
toRoute
;
if
(
toRoute
!=
fromRoute
&&
toRoute
is
PageRoute
<
Object
?>
&&
fromRoute
is
PageRoute
<
Object
?
>)
{
final
PageRoute
<
Object
?
>
from
=
fromRoute
;
final
PageRoute
<
Object
?
>
to
=
toRoute
;
final
Animation
<
double
>
animation
=
(
flightType
==
HeroFlightDirection
.
push
)
?
to
.
animation
!
:
from
.
animation
!;
// A user gesture may have already completed the pop, or we might be the initial route
...
...
@@ -940,8 +940,8 @@ class HeroController extends NavigatorObserver {
// Find the matching pairs of heroes in from and to and either start or a new
// hero flight, or divert an existing one.
void
_startHeroTransition
(
PageRoute
<
dynamic
>
from
,
PageRoute
<
dynamic
>
to
,
PageRoute
<
Object
?
>
from
,
PageRoute
<
Object
?
>
to
,
Animation
<
double
>
animation
,
HeroFlightDirection
flightType
,
bool
isUserGestureTransition
,
...
...
packages/flutter/lib/src/widgets/navigator.dart
View file @
12a2e682
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/routes.dart
View file @
12a2e682
...
...
@@ -225,7 +225,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
}
@override
void
didReplace
(
Route
<
dynamic
>?
oldRoute
)
{
void
didReplace
(
Route
<
Object
?
>?
oldRoute
)
{
assert
(
_controller
!=
null
,
'
$runtimeType
.didReplace called before calling install() or after calling dispose().'
);
assert
(!
_transitionCompleter
.
isCompleted
,
'Cannot reuse a
$runtimeType
after disposing it.'
);
if
(
oldRoute
is
TransitionRoute
)
...
...
@@ -243,7 +243,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
}
@override
void
didPopNext
(
Route
<
dynamic
>
nextRoute
)
{
void
didPopNext
(
Route
<
Object
?
>
nextRoute
)
{
assert
(
_controller
!=
null
,
'
$runtimeType
.didPopNext called before calling install() or after calling dispose().'
);
assert
(!
_transitionCompleter
.
isCompleted
,
'Cannot reuse a
$runtimeType
after disposing it.'
);
_updateSecondaryAnimation
(
nextRoute
);
...
...
@@ -251,7 +251,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
}
@override
void
didChangeNext
(
Route
<
dynamic
>?
nextRoute
)
{
void
didChangeNext
(
Route
<
Object
?
>?
nextRoute
)
{
assert
(
_controller
!=
null
,
'
$runtimeType
.didChangeNext called before calling install() or after calling dispose().'
);
assert
(!
_transitionCompleter
.
isCompleted
,
'Cannot reuse a
$runtimeType
after disposing it.'
);
_updateSecondaryAnimation
(
nextRoute
);
...
...
@@ -265,14 +265,14 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
// caller must reset this property to null after it is called.
VoidCallback
?
_trainHoppingListenerRemover
;
void
_updateSecondaryAnimation
(
Route
<
dynamic
>?
nextRoute
)
{
void
_updateSecondaryAnimation
(
Route
<
Object
?
>?
nextRoute
)
{
// There is an existing train hopping in progress. Unfortunately, we cannot
// dispose current train hopping animation until we replace it with a new
// animation.
final
VoidCallback
?
previousTrainHoppingListenerRemover
=
_trainHoppingListenerRemover
;
_trainHoppingListenerRemover
=
null
;
if
(
nextRoute
is
TransitionRoute
<
dynamic
>
&&
canTransitionTo
(
nextRoute
)
&&
nextRoute
.
canTransitionFrom
(
this
))
{
if
(
nextRoute
is
TransitionRoute
<
Object
?
>
&&
canTransitionTo
(
nextRoute
)
&&
nextRoute
.
canTransitionFrom
(
this
))
{
final
Animation
<
double
>?
current
=
_secondaryAnimation
.
parent
;
if
(
current
!=
null
)
{
final
Animation
<
double
>
currentTrain
=
(
current
is
TrainHoppingAnimation
?
current
.
currentTrain
:
current
)!;
...
...
@@ -348,11 +348,11 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
}
}
void
_setSecondaryAnimation
(
Animation
<
double
>?
animation
,
[
Future
<
dynamic
>?
disposed
])
{
void
_setSecondaryAnimation
(
Animation
<
double
>?
animation
,
[
Future
<
Object
?
>?
disposed
])
{
_secondaryAnimation
.
parent
=
animation
;
// Releases the reference to the next route's animation when that route
// is disposed.
disposed
?.
then
((
dynamic
_
)
{
disposed
?.
then
((
Object
?
_
)
{
if
(
_secondaryAnimation
.
parent
==
animation
)
{
_secondaryAnimation
.
parent
=
kAlwaysDismissedAnimation
;
if
(
animation
is
TrainHoppingAnimation
)
{
...
...
@@ -386,7 +386,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
///
/// * [canTransitionFrom], which must be true for [nextRoute] for the
/// [ModalRoute.buildTransitions] `secondaryAnimation` to run.
bool
canTransitionTo
(
TransitionRoute
<
dynamic
>
nextRoute
)
=>
true
;
bool
canTransitionTo
(
TransitionRoute
<
Object
?
>
nextRoute
)
=>
true
;
/// Returns true if [previousRoute] should animate when this route
/// is pushed on top of it or when then this route is popped off of it.
...
...
@@ -411,7 +411,7 @@ abstract class TransitionRoute<T> extends OverlayRoute<T> {
///
/// * [canTransitionTo], which must be true for [previousRoute] for its
/// [ModalRoute.buildTransitions] `secondaryAnimation` to run.
bool
canTransitionFrom
(
TransitionRoute
<
dynamic
>
previousRoute
)
=>
true
;
bool
canTransitionFrom
(
TransitionRoute
<
Object
?
>
previousRoute
)
=>
true
;
@override
void
dispose
()
{
...
...
@@ -437,7 +437,7 @@ class LocalHistoryEntry {
/// Called when this entry is removed from the history of its associated [LocalHistoryRoute].
final
VoidCallback
?
onRemove
;
LocalHistoryRoute
<
dynamic
>?
_owner
;
LocalHistoryRoute
<
Object
?
>?
_owner
;
/// Remove this entry from the history of its associated [LocalHistoryRoute].
void
remove
()
{
...
...
@@ -660,7 +660,7 @@ class _DismissModalAction extends DismissAction {
@override
bool
isEnabled
(
DismissIntent
intent
)
{
final
ModalRoute
<
dynamic
>
route
=
ModalRoute
.
of
<
dynamic
>(
context
)!;
final
ModalRoute
<
Object
?>
route
=
ModalRoute
.
of
<
Object
?
>(
context
)!;
return
route
.
barrierDismissible
;
}
...
...
@@ -685,7 +685,7 @@ class _ModalScopeStatus extends InheritedWidget {
final
bool
isCurrent
;
final
bool
canPop
;
final
Route
<
dynamic
>
route
;
final
Route
<
Object
?
>
route
;
@override
bool
updateShouldNotify
(
_ModalScopeStatus
old
)
{
...
...
@@ -934,7 +934,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
///
/// This function is typically used with [Navigator.popUntil()].
static
RoutePredicate
withName
(
String
name
)
{
return
(
Route
<
dynamic
>
route
)
{
return
(
Route
<
Object
?
>
route
)
{
return
!
route
.
willHandlePopInternally
&&
route
is
ModalRoute
&&
route
.
settings
.
name
==
name
;
...
...
@@ -1391,7 +1391,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
/// [State.didChangeDependencies] callback:
///
/// ```dart
/// ModalRoute<
dynamic
> _route;
/// ModalRoute<
Object?
> _route;
///
/// @override
/// void didChangeDependencies() {
...
...
@@ -1464,7 +1464,7 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
}
@override
void
didChangePrevious
(
Route
<
dynamic
>?
previousRoute
)
{
void
didChangePrevious
(
Route
<
Object
?
>?
previousRoute
)
{
super
.
didChangePrevious
(
previousRoute
);
changedInternalState
();
}
...
...
@@ -1613,9 +1613,9 @@ abstract class PopupRoute<T> extends ModalRoute<T> {
/// as `always_specify_types`, the Dart analyzer will require that certain types
/// be given with their type arguments. Since the [Route] class and its
/// subclasses have a type argument, this includes the arguments passed to this
/// class. Consider using `
dynamic
` to specify the entire class of routes rather
/// class. Consider using `
Object?
` to specify the entire class of routes rather
/// than only specific subtypes. For example, to watch for all [ModalRoute]
/// variants, the `RouteObserver<ModalRoute<
dynamic
>>` type may be used.
/// variants, the `RouteObserver<ModalRoute<
Object?
>>` type may be used.
///
/// {@tool snippet}
///
...
...
@@ -1670,7 +1670,7 @@ abstract class PopupRoute<T> extends ModalRoute<T> {
/// }
/// ```
/// {@end-tool}
class
RouteObserver
<
R
extends
Route
<
dynamic
>>
extends
NavigatorObserver
{
class
RouteObserver
<
R
extends
Route
<
Object
?
>>
extends
NavigatorObserver
{
final
Map
<
R
,
Set
<
RouteAware
>>
_listeners
=
<
R
,
Set
<
RouteAware
>>{};
/// Subscribe [routeAware] to be informed about changes to [route].
...
...
@@ -1700,7 +1700,7 @@ class RouteObserver<R extends Route<dynamic>> extends NavigatorObserver {
}
@override
void
didPop
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>?
previousRoute
)
{
void
didPop
(
Route
<
Object
?>
route
,
Route
<
Object
?
>?
previousRoute
)
{
if
(
route
is
R
&&
previousRoute
is
R
)
{
final
List
<
RouteAware
>?
previousSubscribers
=
_listeners
[
previousRoute
]?.
toList
();
...
...
@@ -1721,7 +1721,7 @@ class RouteObserver<R extends Route<dynamic>> extends NavigatorObserver {
}
@override
void
didPush
(
Route
<
dynamic
>
route
,
Route
<
dynamic
>?
previousRoute
)
{
void
didPush
(
Route
<
Object
?>
route
,
Route
<
Object
?
>?
previousRoute
)
{
if
(
route
is
R
&&
previousRoute
is
R
)
{
final
Set
<
RouteAware
>?
previousSubscribers
=
_listeners
[
previousRoute
];
...
...
packages/flutter/lib/src/widgets/will_pop_scope.dart
View file @
12a2e682
...
...
@@ -117,7 +117,7 @@ class WillPopScope extends StatefulWidget {
}
class
_WillPopScopeState
extends
State
<
WillPopScope
>
{
ModalRoute
<
dynamic
>?
_route
;
ModalRoute
<
Object
?
>?
_route
;
@override
void
didChangeDependencies
()
{
...
...
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