-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[device_info_platform_interface][device_info] nnbd #3144
Changes from all commits
09b2a8c
67e640d
9ed7d17
b9491ba
663e074
3dfbb26
c9c8193
f2bb3d8
628bc38
5eaebe8
fb7648e
e7f58b6
6474e0e
13e96c1
99f6c53
b4f0af2
4844b52
5104fc2
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 |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 0.5.0-nullsafety | ||
|
|
||
| * Migrate to null safety. | ||
|
|
||
| ## 0.4.2+9 | ||
|
|
||
| * Update android compileSdkVersion to 29. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| include: ../../../analysis_options.yaml | ||
| analyzer: | ||
| enable-experiment: | ||
| - non-nullable |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 1.1.0-nullsafety | ||
|
|
||
| * Migrate to null safety. | ||
|
|
||
| ## 1.0.1 | ||
|
|
||
| - Documentation typo fixed. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| include: ../../../analysis_options.yaml | ||
| analyzer: | ||
| enable-experiment: | ||
| - non-nullable |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,28 +8,28 @@ | |
| class AndroidDeviceInfo { | ||
| /// Android device Info class. | ||
| AndroidDeviceInfo({ | ||
| this.version, | ||
| this.board, | ||
| this.bootloader, | ||
| this.brand, | ||
| this.device, | ||
| this.display, | ||
| this.fingerprint, | ||
| this.hardware, | ||
| this.host, | ||
| this.id, | ||
| this.manufacturer, | ||
| this.model, | ||
| this.product, | ||
| List<String> supported32BitAbis, | ||
| List<String> supported64BitAbis, | ||
| List<String> supportedAbis, | ||
| this.tags, | ||
| this.type, | ||
| this.isPhysicalDevice, | ||
| this.androidId, | ||
| List<String> systemFeatures, | ||
| }) : supported32BitAbis = List<String>.unmodifiable(supported32BitAbis), | ||
| required this.version, | ||
|
Contributor
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. We have forked this package internally and my migration followed a different path. I am not a fan of making all these fields
In my migration, I marked all these fields as nullable. However, this failed tests because gallery uses this code and assumes they are not nullable. 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.
If it's referring to usage of When looking at this, we were trying to answer the question of what is a valid In my opinion, if everything is nullable by default, then the API becomes some sort of "best-effort". "we think This was the rationale behind it. That said, could you point to the cases where testing was painful?
Contributor
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.
That means these fields are not supposed to be nullable. In that case, it would be far better to construct them via map values like so: someField: map[key]!,
// rather than
// someField: map[key] ?? '',The code, today, reads like any one of these values can be non-existent and that's OK. The test pain is a secondary reason. If these are truly non-nullable values, you can always expose a 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.
|
||
| required this.board, | ||
| required this.bootloader, | ||
| required this.brand, | ||
| required this.device, | ||
| required this.display, | ||
| required this.fingerprint, | ||
| required this.hardware, | ||
| required this.host, | ||
| required this.id, | ||
| required this.manufacturer, | ||
| required this.model, | ||
| required this.product, | ||
| required List<String> supported32BitAbis, | ||
| required List<String> supported64BitAbis, | ||
| required List<String> supportedAbis, | ||
| required this.tags, | ||
| required this.type, | ||
| required this.isPhysicalDevice, | ||
| required this.androidId, | ||
| required List<String> systemFeatures, | ||
| }) : supported32BitAbis = List<String>.unmodifiable(supported32BitAbis), | ||
| supported64BitAbis = List<String>.unmodifiable(supported64BitAbis), | ||
| supportedAbis = List<String>.unmodifiable(supportedAbis), | ||
| systemFeatures = List<String>.unmodifiable(systemFeatures); | ||
|
|
@@ -115,25 +115,25 @@ class AndroidDeviceInfo { | |
| return AndroidDeviceInfo( | ||
| version: AndroidBuildVersion._fromMap( | ||
| map['version']?.cast<String, dynamic>() ?? {}), | ||
| board: map['board'], | ||
| bootloader: map['bootloader'], | ||
| brand: map['brand'], | ||
| device: map['device'], | ||
| display: map['display'], | ||
| fingerprint: map['fingerprint'], | ||
| hardware: map['hardware'], | ||
| host: map['host'], | ||
| id: map['id'], | ||
| manufacturer: map['manufacturer'], | ||
| model: map['model'], | ||
| product: map['product'], | ||
| board: map['board'] ?? '', | ||
| bootloader: map['bootloader'] ?? '', | ||
| brand: map['brand'] ?? '', | ||
| device: map['device'] ?? '', | ||
| display: map['display'] ?? '', | ||
| fingerprint: map['fingerprint'] ?? '', | ||
| hardware: map['hardware'] ?? '', | ||
| host: map['host'] ?? '', | ||
| id: map['id'] ?? '', | ||
| manufacturer: map['manufacturer'] ?? '', | ||
| model: map['model'] ?? '', | ||
| product: map['product'] ?? '', | ||
| supported32BitAbis: _fromList(map['supported32BitAbis'] ?? []), | ||
| supported64BitAbis: _fromList(map['supported64BitAbis'] ?? []), | ||
| supportedAbis: _fromList(map['supportedAbis'] ?? []), | ||
| tags: map['tags'], | ||
| type: map['type'], | ||
| isPhysicalDevice: map['isPhysicalDevice'], | ||
| androidId: map['androidId'], | ||
| tags: map['tags'] ?? '', | ||
| type: map['type'] ?? '', | ||
| isPhysicalDevice: map['isPhysicalDevice'] ?? false, | ||
| androidId: map['androidId'] ?? '', | ||
| systemFeatures: _fromList(map['systemFeatures'] ?? []), | ||
| ); | ||
| } | ||
|
|
@@ -151,13 +151,13 @@ class AndroidDeviceInfo { | |
| /// See: https://developer.android.com/reference/android/os/Build.VERSION.html | ||
| class AndroidBuildVersion { | ||
| AndroidBuildVersion._({ | ||
| this.baseOS, | ||
| this.codename, | ||
| this.incremental, | ||
| this.previewSdkInt, | ||
| this.release, | ||
| this.sdkInt, | ||
| this.securityPatch, | ||
| required this.baseOS, | ||
| required this.codename, | ||
| required this.incremental, | ||
| required this.previewSdkInt, | ||
| required this.release, | ||
| required this.sdkInt, | ||
| required this.securityPatch, | ||
| }); | ||
|
|
||
| /// The base OS build the product is based on. | ||
|
|
@@ -186,13 +186,13 @@ class AndroidBuildVersion { | |
| /// Deserializes from the map message received from [_kChannel]. | ||
| static AndroidBuildVersion _fromMap(Map<String, dynamic> map) { | ||
| return AndroidBuildVersion._( | ||
| baseOS: map['baseOS'], | ||
| codename: map['codename'], | ||
| incremental: map['incremental'], | ||
| previewSdkInt: map['previewSdkInt'], | ||
| release: map['release'], | ||
| sdkInt: map['sdkInt'], | ||
| securityPatch: map['securityPatch'], | ||
| baseOS: map['baseOS'] ?? '', | ||
| codename: map['codename'] ?? '', | ||
| incremental: map['incremental'] ?? '', | ||
| previewSdkInt: map['previewSdkInt'] ?? 0, | ||
| release: map['release'] ?? '', | ||
| sdkInt: map['sdkInt'] ?? 0, | ||
| securityPatch: map['securityPatch'] ?? '', | ||
| ); | ||
| } | ||
| } | ||
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.
We are going with git dependencies, but feel free to change it after this PR is merged.