Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit f98493d

Browse files
author
Chris Yang
authored
[device_info_platform_interface][device_info] nnbd (#3144)
1 parent ce3b264 commit f98493d

File tree

15 files changed

+126
-91
lines changed

15 files changed

+126
-91
lines changed

packages/device_info/device_info/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.0-nullsafety
2+
3+
* Migrate to null safety.
4+
15
## 0.4.2+9
26

37
* Update android compileSdkVersion to 29.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include: ../../../analysis_options.yaml
2+
analyzer:
3+
enable-experiment:
4+
- non-nullable

packages/device_info/device_info/example/integration_test/device_info_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// TODO(cyanglaz): Remove once https://github.com/flutter/plugins/pull/3158 is landed.
6+
// @dart = 2.9
57
import 'dart:io';
68
import 'package:flutter_test/flutter_test.dart';
79
import 'package:device_info/device_info.dart';

packages/device_info/device_info/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class _MyAppState extends State<MyApp> {
3636
}
3737

3838
Future<void> initPlatformState() async {
39-
Map<String, dynamic> deviceData;
39+
Map<String, dynamic> deviceData = <String, dynamic>{};
4040

4141
try {
4242
if (Platform.isAndroid) {

packages/device_info/device_info/example/pubspec.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ dev_dependencies:
1212
sdk: flutter
1313
integration_test:
1414
path: ../../../integration_test
15-
pedantic: ^1.8.0
15+
pedantic: ^1.10.0-nullsafety.1
1616

1717
flutter:
1818
uses-material-design: true
19+
20+
environment:
21+
sdk: '>=2.10.0-56.0.dev <3.0.0'

packages/device_info/device_info/example/test_driver/integration_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// TODO(cyanglaz): Remove once https://github.com/flutter/flutter/issues/59879 is fixed.
6+
// @dart = 2.9
57
import 'dart:async';
68
import 'dart:convert';
79
import 'dart:io';

packages/device_info/device_info/lib/device_info.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DeviceInfoPlugin {
1515
DeviceInfoPlugin();
1616

1717
/// This information does not change from call to call. Cache it.
18-
AndroidDeviceInfo _cachedAndroidDeviceInfo;
18+
AndroidDeviceInfo? _cachedAndroidDeviceInfo;
1919

2020
/// Information derived from `android.os.Build`.
2121
///
@@ -25,7 +25,7 @@ class DeviceInfoPlugin {
2525
await DeviceInfoPlatform.instance.androidInfo();
2626

2727
/// This information does not change from call to call. Cache it.
28-
IosDeviceInfo _cachedIosDeviceInfo;
28+
IosDeviceInfo? _cachedIosDeviceInfo;
2929

3030
/// Information derived from `UIDevice`.
3131
///

packages/device_info/device_info/pubspec.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/device_info
55
# 0.4.y+z is compatible with 1.0.0, if you land a breaking change bump
66
# the version to 2.0.0.
77
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
8-
version: 0.4.2+9
8+
version: 0.5.0-nullsafety
9+
10+
# Don't publish this package until null safety is stable or the package is in the allow list.
11+
publish_to: none
912

1013
flutter:
1114
plugin:
@@ -19,14 +22,15 @@ flutter:
1922
dependencies:
2023
flutter:
2124
sdk: flutter
22-
device_info_platform_interface: ^1.0.0
25+
device_info_platform_interface:
26+
path: ../device_info_platform_interface
2327

2428
dev_dependencies:
25-
test: ^1.3.0
29+
test: ^1.10.0-nullsafety.1
2630
flutter_test:
2731
sdk: flutter
28-
pedantic: ^1.8.0
32+
pedantic: ^1.10.0-nullsafety.1
2933

3034
environment:
31-
sdk: ">=2.1.0<3.0.0"
35+
sdk: '>=2.10.0-56.0.dev <3.0.0'
3236
flutter: ">=1.12.13+hotfix.5 <2.0.0"

packages/device_info/device_info_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.0-nullsafety
2+
3+
* Migrate to null safety.
4+
15
## 1.0.1
26

37
- Documentation typo fixed.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include: ../../../analysis_options.yaml
2+
analyzer:
3+
enable-experiment:
4+
- non-nullable

0 commit comments

Comments
 (0)