File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
lib/src/extensions/build_context Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -2,31 +2,31 @@ import 'package:flutter/material.dart';
2
2
3
3
extension NavigationHelpers on BuildContext {
4
4
/// Push the given page onto the navigator.
5
- void pushPage (
5
+ Future < void > pushPage < T extends Object ?> (
6
6
Widget page, {
7
7
bool dismissKeyboard = true ,
8
8
bool avoidDuplicatePage = true ,
9
- }) {
10
- pushRoute (
11
- MaterialPageRoute <Widget >(builder: (context) => page),
9
+ }) async {
10
+ await pushRoute < T > (
11
+ MaterialPageRoute <T >(builder: (context) => page),
12
12
dismissKeyboard: dismissKeyboard,
13
13
avoidDuplicateRoute: avoidDuplicatePage,
14
14
);
15
15
}
16
16
17
17
/// Push the given route onto the navigator.
18
- void pushRoute (
19
- Route route, {
18
+ Future < void > pushRoute < T extends Object ?> (
19
+ Route < T > route, {
20
20
bool dismissKeyboard = true ,
21
21
bool avoidDuplicateRoute = true ,
22
- }) {
22
+ }) async {
23
23
if (dismissKeyboard) this .dismissKeyboard ();
24
24
25
25
if (avoidDuplicateRoute && route.isCurrent) {
26
26
debugPrint (
27
27
'INFO: New route is not pushed because it is already the current route!' );
28
28
} else {
29
- Navigator .of (this ).push <void >(route);
29
+ await Navigator .of (this ).push <T >(route);
30
30
}
31
31
}
32
32
You can’t perform that action at this time.
0 commit comments