Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix webasm compliancy (should fix #3253)
  • Loading branch information
arnaudruffin committed Sep 12, 2024
commit 22921f21c232329ddeb0081d890b7c94fc656fe9
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 @@ -47,7 +48,6 @@ 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;
external double? 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
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