Skip to content

Commit

Permalink
Add Navigator funcitons for pushReplacement
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3rndt committed Nov 3, 2023
1 parent 79986a2 commit f8db95e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/utils/navigator_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,19 @@ Future<T?> pushScreenWithNavBar<T>(BuildContext context, Widget screen) =>
@optionalTypeArgs
Future<T?> pushScreenWithoutNavBar<T>(BuildContext context, Widget screen) =>
pushScreen<T>(context, screen: screen);

@optionalTypeArgs
Future<T?> pushReplacementWithNavBar<T extends Object?, TO extends Object?>(
BuildContext context,
Route<T> route, {
TO? result,
}) =>
Navigator.of(context).pushReplacement<T, TO>(route);

@optionalTypeArgs
Future<T?> pushReplacementWithoutNavBar<T extends Object?, TO extends Object?>(
BuildContext context,
Route<T> route, {
TO? result,
}) =>
Navigator.of(context, rootNavigator: true).pushReplacement<T, TO>(route);

0 comments on commit f8db95e

Please sign in to comment.