Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@
<link rel="manifest" href="manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('flutter_service_worker.js');
});
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
<script src="flutter_bootstrap.js" async></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:js_interop';
import 'package:web/web.dart' as html show window, Navigator;

import 'package:device_info_plus_platform_interface/device_info_plus_platform_interface.dart';
Expand Down Expand Up @@ -30,7 +31,7 @@ class DeviceInfoPlusWebPlugin extends DeviceInfoPlatform {
'appVersion': _navigator.appVersion,
'deviceMemory': _navigator.deviceMemory,
'language': _navigator.language,
'languages': _navigator.languages,
'languages': _navigator.languages.toDart,
'platform': _navigator.platform,
'product': _navigator.product,
'productSub': _navigator.productSub,
Expand All @@ -44,10 +45,3 @@ class DeviceInfoPlusWebPlugin extends DeviceInfoPlatform {
);
}
}

/// Property is missing.
/// Ticket: https://github.com/dart-lang/web/issues/192
/// Probably won't be an int? in the future!
extension on html.Navigator {
external int? get deviceMemory;
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class WebBrowserInfo implements BaseDeviceInfo {
final String? appVersion;

/// the amount of device memory in gigabytes. This value is an approximation given by rounding to the nearest power of 2 and dividing that number by 1024.
final int? deviceMemory;
final double? deviceMemory;

/// a DOMString representing the preferred language of the user, usually the language of the browser UI. The null value is returned when this is unknown.
final String? language;
Expand Down
2 changes: 1 addition & 1 deletion packages/device_info_plus/device_info_plus/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies:
flutter_web_plugins:
sdk: flutter
meta: ^1.8.0
web: ">=0.5.0 <2.0.0"
web: ^1.0.0
win32: ^5.5.3
win32_registry: ^1.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void main() {
'appCodeName': 'appCodeName',
'appName': 'appName',
'appVersion': 'appVersion',
'deviceMemory': 42,
'deviceMemory': 42.0,
'language': 'language',
'languages': ['en', 'es'],
'platform': 'platform',
Expand Down