import 'package:web/web.dart' as web;

/// Web implementation of browser APIs using package:web.
class BrowserStorage {
  String? getItem(String key) => web.window.localStorage.getItem(key);
  void setItem(String key, String value) =>
      web.window.localStorage.setItem(key, value);
  void removeItem(String key) =>
      web.window.localStorage.removeItem(key);
}

/// Web implementation for window.location
class BrowserLocation {
  String get href => web.window.location.href;
  set href(String value) => web.window.location.href = value;
}

/// Browser utility class using package:web.
class Browser {
  static final BrowserStorage localStorage = BrowserStorage();
  static final BrowserLocation location = BrowserLocation();
}