Skip to content

Commit

Permalink
Replace some dynamic to Object? type (flutter#80772)
Browse files Browse the repository at this point in the history
  • Loading branch information
xu-baolin authored Apr 21, 2021
1 parent 07a6b8f commit 12a2e68
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 146 deletions.
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/material/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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>{
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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!);
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter/lib/src/material/scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down
26 changes: 13 additions & 13 deletions packages/flutter/lib/src/widgets/heroes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 12a2e68

Please sign in to comment.