Skip to content

Commit

Permalink
Merge pull request #1952 from pedromneto97/master
Browse files Browse the repository at this point in the history
Migrate to package:web
  • Loading branch information
Milad-Akarie committed Jun 12, 2024
2 parents 263d409 + 85e2e9d commit 31657c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart';

import 'navigation_history.dart'
if (dart.library.io) 'native_navigation_history.dart'
if (dart.library.html) 'web_navigation_history.dart';
if (dart.library.js_interop) 'web_navigation_history.dart';

/// An abstraction on a navigation history tracker
/// that utilises browser history on web and mimics it on native
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:auto_route/auto_route.dart';
import 'dart:js_interop';

// ignore: avoid_web_libraries_in_flutter
import 'dart:html' as html;
import 'package:auto_route/auto_route.dart';
import 'package:web/web.dart';

import 'navigation_history_base.dart';

Expand All @@ -14,15 +14,15 @@ class NavigationHistoryImpl extends NavigationHistory {
@override
final StackRouter router;

final _history = html.window.history;
final _history = window.history;

@override
void back() {
_history.back();
}

int get _currentIndex {
final state = _history.state;
final state = _history.state.dartify();
if (state is Map) {
return state['serialCount'] ?? 0;
}
Expand Down
2 changes: 2 additions & 0 deletions auto_route/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ dependencies:
flutter:
sdk: flutter
path: ^1.9.0
web: ^0.5.1
collection: ^1.18.0
meta: ^1.12.0




dev_dependencies:
build_runner:
mockito: ^5.4.4
Expand Down

0 comments on commit 31657c7

Please sign in to comment.