Unverified Commit 4f5cc21b authored by 嘟囔's avatar 嘟囔 Committed by GitHub

migrate some file to null safety (#92957)

parent a8c78097
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import '../src/common.dart'; import '../src/common.dart';
...@@ -12,12 +10,12 @@ import 'test_utils.dart'; ...@@ -12,12 +10,12 @@ import 'test_utils.dart';
final String analyzerSeparator = platform.isWindows ? '-' : '•'; final String analyzerSeparator = platform.isWindows ? '-' : '•';
void main() { void main() {
Directory tempDir; late Directory tempDir;
String projectPath; late String projectPath;
File libMain; late File libMain;
Future<void> runCommand({ Future<void> runCommand({
List<String> arguments, List<String> arguments = const <String>[],
List<String> statusTextContains = const <String>[], List<String> statusTextContains = const <String>[],
List<String> errorTextContains = const <String>[], List<String> errorTextContains = const <String>[],
String exitMessageContains = '', String exitMessageContains = '',
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:file_testing/file_testing.dart'; import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file_testing/file_testing.dart'; import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
...@@ -11,7 +9,7 @@ import '../src/common.dart'; ...@@ -11,7 +9,7 @@ import '../src/common.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
Directory tempDir; late Directory tempDir;
setUp(() async { setUp(() async {
tempDir = createResolvedTempDirectorySync('flutter_plugin_test.'); tempDir = createResolvedTempDirectorySync('flutter_plugin_test.');
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'package:file/file.dart'; import 'package:file/file.dart';
...@@ -14,7 +12,7 @@ import 'test_driver.dart'; ...@@ -14,7 +12,7 @@ import 'test_driver.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
Directory tempDir; late Directory tempDir;
setUp(() async { setUp(() async {
tempDir = createResolvedTempDirectorySync('hot_reload_test.'); tempDir = createResolvedTempDirectorySync('hot_reload_test.');
...@@ -56,7 +54,7 @@ void main() { ...@@ -56,7 +54,7 @@ void main() {
// Wait a tiny amount of time in case we did not kill the background isolate. // Wait a tiny amount of time in case we did not kill the background isolate.
await Future<void>.delayed(const Duration(milliseconds: 10)); await Future<void>.delayed(const Duration(milliseconds: 10));
await subscription.cancel(); await subscription.cancel();
await flutter?.stop(); await flutter.stop();
}); });
testWithoutContext('Hot reload updates background isolates', () async { testWithoutContext('Hot reload updates background isolates', () async {
...@@ -84,6 +82,6 @@ void main() { ...@@ -84,6 +82,6 @@ void main() {
await flutter.hotReload(); await flutter.hotReload();
await sawNewBackgroundMessage.future; await sawNewBackgroundMessage.future;
await subscription.cancel(); await subscription.cancel();
await flutter?.stop(); await flutter.stop();
}); });
} }
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file_testing/file_testing.dart'; import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:convert'; import 'dart:convert';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
...@@ -138,11 +136,11 @@ void main() { ...@@ -138,11 +136,11 @@ void main() {
'--machine', '--machine',
]); ]);
final Map<String, Object> versionInfo = json.decode(result.stdout final Map<String, Object?> versionInfo = json.decode(result.stdout
.toString() .toString()
.replaceAll('Building flutter tool...', '') .replaceAll('Building flutter tool...', '')
.replaceAll('Waiting for another flutter command to release the startup lock...', '') .replaceAll('Waiting for another flutter command to release the startup lock...', '')
.trim()) as Map<String, Object>; .trim()) as Map<String, Object?>;
expect(versionInfo, containsPair('flutterRoot', isNotNull)); expect(versionInfo, containsPair('flutterRoot', isNotNull));
}); });
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:file_testing/file_testing.dart'; import 'package:file_testing/file_testing.dart';
...@@ -14,7 +12,7 @@ import 'test_driver.dart'; ...@@ -14,7 +12,7 @@ import 'test_driver.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
Directory tempDir; late Directory tempDir;
setUp(() async { setUp(() async {
tempDir = createResolvedTempDirectorySync('flutter_coverage_collection_test.'); tempDir = createResolvedTempDirectorySync('flutter_coverage_collection_test.');
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/file.dart'; import 'package:file/file.dart';
import '../src/common.dart'; import '../src/common.dart';
...@@ -12,7 +10,7 @@ import 'test_driver.dart'; ...@@ -12,7 +10,7 @@ import 'test_driver.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
Directory tempDir; late Directory tempDir;
setUp(() async { setUp(() async {
tempDir = createResolvedTempDirectorySync('debugger_stepping_test.'); tempDir = createResolvedTempDirectorySync('debugger_stepping_test.');
...@@ -32,13 +30,13 @@ void main() { ...@@ -32,13 +30,13 @@ void main() {
await _flutter.addBreakpoint(_project.breakpointUri, _project.breakpointLine); await _flutter.addBreakpoint(_project.breakpointUri, _project.breakpointLine);
await _flutter.resume(waitForNextPause: true); // Now we should be on the breakpoint. await _flutter.resume(waitForNextPause: true); // Now we should be on the breakpoint.
expect((await _flutter.getSourceLocation()).line, equals(_project.breakpointLine)); expect((await _flutter.getSourceLocation())?.line, equals(_project.breakpointLine));
// Issue 5 steps, ensuring that we end up on the annotated lines each time. // Issue 5 steps, ensuring that we end up on the annotated lines each time.
for (int i = 1; i <= _project.numberOfSteps; i += 1) { for (int i = 1; i <= _project.numberOfSteps; i += 1) {
await _flutter.stepOverOrOverAsyncSuspension(); await _flutter.stepOverOrOverAsyncSuspension();
final SourcePosition location = await _flutter.getSourceLocation(); final SourcePosition? location = await _flutter.getSourceLocation();
final int actualLine = location.line; final int? actualLine = location?.line;
// Get the line we're expected to stop at by searching for the comment // Get the line we're expected to stop at by searching for the comment
// within the source code. // within the source code.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment