Skip to content

Commit

Permalink
chore(app): create routing utils
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Dec 12, 2023
1 parent beffff8 commit 4355e37
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions app/lib/common/utilities/module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export 'genome_data.dart';
export 'material_colors.dart';
export 'networking_utils.dart';
export 'platform_utils.dart';
export 'routing_utils.dart';
export 'string_utils.dart';
13 changes: 0 additions & 13 deletions app/lib/common/utilities/networking_utils.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'dart:io';

import '../module.dart';

Future<bool> hasConnectionTo(String host) async {
try {
final result = await InternetAddress.lookup(host);
Expand All @@ -10,14 +8,3 @@ Future<bool> hasConnectionTo(String host) async {
return false;
}
}

// Replace whole stack, see https://stackoverflow.com/a/73784156
Future<void> overwriteRoutes(
BuildContext context,
{ required PageRouteInfo nextPage }
) async {
await context.router.pushAndPopUntil(
nextPage,
predicate: (_) => false
);
}
12 changes: 12 additions & 0 deletions app/lib/common/utilities/routing_utils.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import '../module.dart';

// Replace whole stack, see https://stackoverflow.com/a/73784156
Future<void> overwriteRoutes(
BuildContext context,
{ required PageRouteInfo nextPage }
) async {
await context.router.pushAndPopUntil(
nextPage,
predicate: (_) => false
);
}

0 comments on commit 4355e37

Please sign in to comment.