Migrate android_console to null safety (#78923)

This commit is contained in:
Jenn Magder
2021-03-24 15:18:00 -07:00
committed by GitHub
parent 7148cc61f3
commit ce31d4ff7e
7 changed files with 35 additions and 49 deletions

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'dart:io' as io show IOOverrides, Directory, File, Link;
import 'package:flutter_tools/src/base/file_system.dart';
@@ -19,17 +17,17 @@ import 'package:flutter_tools/src/base/file_system.dart';
/// The only safe delegate types are those that do not call out to `dart:io`,
/// like the [MemoryFileSystem].
class FlutterIOOverrides extends io.IOOverrides {
FlutterIOOverrides({ FileSystem fileSystem })
FlutterIOOverrides({ FileSystem? fileSystem })
: _fileSystemDelegate = fileSystem;
final FileSystem _fileSystemDelegate;
final FileSystem? _fileSystemDelegate;
@override
io.Directory createDirectory(String path) {
if (_fileSystemDelegate == null) {
return super.createDirectory(path);
}
return _fileSystemDelegate.directory(path);
return _fileSystemDelegate!.directory(path);
}
@override
@@ -37,7 +35,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.createFile(path);
}
return _fileSystemDelegate.file(path);
return _fileSystemDelegate!.file(path);
}
@override
@@ -45,7 +43,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.createLink(path);
}
return _fileSystemDelegate.link(path);
return _fileSystemDelegate!.link(path);
}
@override
@@ -53,7 +51,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.fsWatch(path, events, recursive);
}
return _fileSystemDelegate.file(path).watch(events: events, recursive: recursive);
return _fileSystemDelegate!.file(path).watch(events: events, recursive: recursive);
}
@override
@@ -61,7 +59,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.fsWatchIsSupported();
}
return _fileSystemDelegate.isWatchSupported;
return _fileSystemDelegate!.isWatchSupported;
}
@override
@@ -69,7 +67,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.fseGetType(path, followLinks);
}
return _fileSystemDelegate.type(path, followLinks: followLinks ?? true);
return _fileSystemDelegate!.type(path, followLinks: followLinks);
}
@override
@@ -77,7 +75,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.fseGetTypeSync(path, followLinks);
}
return _fileSystemDelegate.typeSync(path, followLinks: followLinks ?? true);
return _fileSystemDelegate!.typeSync(path, followLinks: followLinks);
}
@override
@@ -85,7 +83,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.fseIdentical(path1, path2);
}
return _fileSystemDelegate.identical(path1, path2);
return _fileSystemDelegate!.identical(path1, path2);
}
@override
@@ -93,7 +91,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.fseIdenticalSync(path1, path2);
}
return _fileSystemDelegate.identicalSync(path1, path2);
return _fileSystemDelegate!.identicalSync(path1, path2);
}
@override
@@ -101,7 +99,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.getCurrentDirectory();
}
return _fileSystemDelegate.currentDirectory;
return _fileSystemDelegate!.currentDirectory;
}
@override
@@ -109,7 +107,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.getSystemTempDirectory();
}
return _fileSystemDelegate.systemTempDirectory;
return _fileSystemDelegate!.systemTempDirectory;
}
@override
@@ -117,7 +115,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.setCurrentDirectory(path);
}
_fileSystemDelegate.currentDirectory = path;
_fileSystemDelegate!.currentDirectory = path;
}
@override
@@ -125,7 +123,7 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.stat(path);
}
return _fileSystemDelegate.stat(path);
return _fileSystemDelegate!.stat(path);
}
@override
@@ -133,6 +131,6 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.statSync(path);
}
return _fileSystemDelegate.statSync(path);
return _fileSystemDelegate!.statSync(path);
}
}

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:test/test.dart' hide isInstanceOf;
export 'package:test/test.dart' hide isInstanceOf;