-
-
Notifications
You must be signed in to change notification settings - Fork 973
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
feat(device_info_plus)!: refactor of device_info_plus platform implementation #1293
Changes from all commits
c4362db
00586a5
cc0dc50
56fd354
2b92a3b
4af607e
7f10a09
ecf785b
b66dec2
8028498
688e972
2c9b4ab
4432cf1
baf4625
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,14 @@ | |
// found in the LICENSE file. | ||
|
||
import 'dart:math' as math show sqrt; | ||
import 'base_device_info.dart'; | ||
import 'package:device_info_plus_platform_interface/model/base_device_info.dart'; | ||
|
||
/// Information derived from `android.os.Build`. | ||
/// | ||
/// See: https://developer.android.com/reference/android/os/Build.html | ||
class AndroidDeviceInfo implements BaseDeviceInfo { | ||
/// Android device Info class. | ||
AndroidDeviceInfo({ | ||
class AndroidDeviceInfo extends BaseDeviceInfo { | ||
AndroidDeviceInfo._({ | ||
required Map<String, dynamic> data, | ||
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This private constructor and the |
||
required this.version, | ||
required this.board, | ||
required this.bootloader, | ||
|
@@ -35,7 +35,8 @@ class AndroidDeviceInfo implements BaseDeviceInfo { | |
}) : supported32BitAbis = List<String>.unmodifiable(supported32BitAbis), | ||
supported64BitAbis = List<String>.unmodifiable(supported64BitAbis), | ||
supportedAbis = List<String>.unmodifiable(supportedAbis), | ||
systemFeatures = List<String>.unmodifiable(systemFeatures); | ||
systemFeatures = List<String>.unmodifiable(systemFeatures), | ||
super(data); | ||
|
||
/// Android operating system version values derived from `android.os.Build.VERSION`. | ||
final AndroidBuildVersion version; | ||
|
@@ -116,38 +117,10 @@ class AndroidDeviceInfo implements BaseDeviceInfo { | |
/// Information about the current android display. | ||
final AndroidDisplayMetrics displayMetrics; | ||
|
||
/// Serializes [AndroidDeviceInfo] to map. | ||
@Deprecated('[toMap] method will be discontinued') | ||
@override | ||
Map<String, dynamic> toMap() { | ||
return { | ||
'id': id, | ||
Comment on lines
-119
to
-124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original |
||
'host': host, | ||
'tags': tags, | ||
'type': type, | ||
'model': model, | ||
'board': board, | ||
'brand': brand, | ||
'device': device, | ||
'product': product, | ||
'display': display, | ||
'hardware': hardware, | ||
'bootloader': bootloader, | ||
'version': version.toMap(), | ||
'fingerprint': fingerprint, | ||
'manufacturer': manufacturer, | ||
'supportedAbis': supportedAbis, | ||
'systemFeatures': systemFeatures, | ||
'isPhysicalDevice': isPhysicalDevice, | ||
'supported32BitAbis': supported32BitAbis, | ||
'supported64BitAbis': supported64BitAbis, | ||
'displayMetrics': displayMetrics.toMap(), | ||
}; | ||
} | ||
|
||
/// Deserializes from the message received from [_kChannel]. | ||
static AndroidDeviceInfo fromMap(Map<String, dynamic> map) { | ||
return AndroidDeviceInfo( | ||
return AndroidDeviceInfo._( | ||
data: map, | ||
version: AndroidBuildVersion._fromMap( | ||
map['version']?.cast<String, dynamic>() ?? {}), | ||
board: map['board'], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'base_device_info.dart'; | ||
import 'package:device_info_plus_platform_interface/model/base_device_info.dart'; | ||
|
||
/// Device information for a Linux system. | ||
/// | ||
|
@@ -139,8 +139,11 @@ class LinuxDeviceInfo implements BaseDeviceInfo { | |
/// decoded from hexadecimal, this corresponds to a 16-byte/128-bit value. | ||
final String? machineId; | ||
|
||
/// Serializes [LinuxDeviceInfo] to a map. | ||
@Deprecated('[toMap] method will be discontinued') | ||
@override | ||
// ignore: deprecated_member_use_from_same_package | ||
Map<String, dynamic> get data => toMap(); | ||
|
||
@Deprecated('Use [data] getter instead') | ||
Comment on lines
+142
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With dart plugins, they can implement the |
||
@override | ||
Map<String, dynamic> toMap() { | ||
return { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any new platform implementing
deviceInfo()
can now return a genericBaseDeviceInfo
with some data