From 239ed7cf43227fea715fc3f49257bc0cb6680888 Mon Sep 17 00:00:00 2001 From: Giacomo Pignoni Date: Fri, 9 Aug 2024 14:10:55 +0200 Subject: [PATCH] fix wasm --- .../device_info_plus/lib/src/device_info_plus_web.dart | 5 +++-- .../device_info_plus/lib/src/model/web_browser_info.dart | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/device_info_plus/device_info_plus/lib/src/device_info_plus_web.dart b/packages/device_info_plus/device_info_plus/lib/src/device_info_plus_web.dart index 4ebe0b874f..ee308bf58d 100644 --- a/packages/device_info_plus/device_info_plus/lib/src/device_info_plus_web.dart +++ b/packages/device_info_plus/device_info_plus/lib/src/device_info_plus_web.dart @@ -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'; @@ -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, @@ -49,5 +50,5 @@ class DeviceInfoPlusWebPlugin extends DeviceInfoPlatform { /// 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; } diff --git a/packages/device_info_plus/device_info_plus/lib/src/model/web_browser_info.dart b/packages/device_info_plus/device_info_plus/lib/src/model/web_browser_info.dart index dfad60aa96..03fa7f83cc 100644 --- a/packages/device_info_plus/device_info_plus/lib/src/model/web_browser_info.dart +++ b/packages/device_info_plus/device_info_plus/lib/src/model/web_browser_info.dart @@ -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;