diff --git a/packages/device_info_plus/device_info_plus/example/web/index.html b/packages/device_info_plus/device_info_plus/example/web/index.html index a0c14606fc..99eacb2839 100644 --- a/packages/device_info_plus/device_info_plus/example/web/index.html +++ b/packages/device_info_plus/device_info_plus/example/web/index.html @@ -18,16 +18,6 @@ - - - + 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..1112acbbe6 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, @@ -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; -} 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; diff --git a/packages/device_info_plus/device_info_plus/pubspec.yaml b/packages/device_info_plus/device_info_plus/pubspec.yaml index be63972e14..48c932959d 100644 --- a/packages/device_info_plus/device_info_plus/pubspec.yaml +++ b/packages/device_info_plus/device_info_plus/pubspec.yaml @@ -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 diff --git a/packages/device_info_plus/device_info_plus/test/model/web_browser_info_test.dart b/packages/device_info_plus/device_info_plus/test/model/web_browser_info_test.dart index 51e5fa6a0f..15b4f49705 100644 --- a/packages/device_info_plus/device_info_plus/test/model/web_browser_info_test.dart +++ b/packages/device_info_plus/device_info_plus/test/model/web_browser_info_test.dart @@ -11,7 +11,7 @@ void main() { 'appCodeName': 'appCodeName', 'appName': 'appName', 'appVersion': 'appVersion', - 'deviceMemory': 42, + 'deviceMemory': 42.0, 'language': 'language', 'languages': ['en', 'es'], 'platform': 'platform',