Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(device_info_plus): fix type casting for WASM #3161

Closed
wants to merge 1 commit into from
Closed
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
@@ -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 @@
'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 @@ -49,5 +50,5 @@
/// 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;

Check notice on line 53 in packages/device_info_plus/device_info_plus/lib/src/device_info_plus_web.dart

View workflow job for this annotation

GitHub Actions / Dart Analyzer

The declaration 'deviceMemory' isn't referenced.

Try removing the declaration of 'deviceMemory'. See https://dart.dev/diagnostics/unused_element to learn more about this problem.
}
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
Loading