fixing android build
This commit is contained in:
22
lib/platform/browser_web.dart
Normal file
22
lib/platform/browser_web.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user