Skip to content

Commit

Permalink
Merge pull request #2987 from devee-dev/master
Browse files Browse the repository at this point in the history
switch to package:web to support wasm compilation
  • Loading branch information
jonataslaw authored Mar 8, 2024
2 parents 80ee800 + a0c6631 commit 272aa46
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
9 changes: 6 additions & 3 deletions lib/get_navigation/src/routes/get_router_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,12 @@ class GetDelegate extends RouterDelegate<RouteDecoder>
}) async {
// remove history or page entries until you meet route
var iterator = currentConfiguration;
while (_canPop(popMode) &&
iterator != null &&
iterator.pageSettings?.name != fullRoute) {
while (_canPop(popMode) && iterator != null) {
//the next line causes wasm compile error if included in the while loop
//https://github.com/flutter/flutter/issues/140110
if (iterator.pageSettings?.name == fullRoute) {
break;
}
await _pop(popMode, null);
// replace iterator
iterator = currentConfiguration;
Expand Down
2 changes: 1 addition & 1 deletion lib/get_navigation/src/routes/page_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extension PageArgExt on BuildContext {
String get location {
final parser = router.routeInformationParser;
final config = delegate.currentConfiguration;
return parser?.restoreRouteInformation(config)?.location ?? '/';
return parser?.restoreRouteInformation(config)?.uri.toString() ?? '/';
}

GetDelegate get delegate {
Expand Down
4 changes: 2 additions & 2 deletions lib/get_utils/src/platform/platform_web.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ignore: avoid_web_libraries_in_flutter
import 'dart:html' as html;
import 'package:web/web.dart' as html;

import '../../get_utils.dart';

Expand All @@ -25,7 +25,7 @@ class GeneralPlatform {
static bool get isIOS {
// maxTouchPoints is needed to separate iPad iOS13 vs new MacOS
return GetUtils.hasMatch(_navigator.platform, r'/iPad|iPhone|iPod/') ||
(_navigator.platform == 'MacIntel' && _navigator.maxTouchPoints! > 1);
(_navigator.platform == 'MacIntel' && _navigator.maxTouchPoints > 1);
}

static bool get isFuchsia => false;
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
sdk: flutter
flutter_web_plugins:
sdk: flutter
web: any

dev_dependencies:
flutter_lints: ^2.0.3
Expand Down

0 comments on commit 272aa46

Please sign in to comment.