Force all dart:io usage to go through 'base/io.dart' (#7390)

This ensures that accidental usages of dart:io's
file API don't creep in over time.
diff --git a/packages/flutter_tools/lib/executable.dart b/packages/flutter_tools/lib/executable.dart
index a5a7bb6..3a0ba9a 100644
--- a/packages/flutter_tools/lib/executable.dart
+++ b/packages/flutter_tools/lib/executable.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:args/command_runner.dart';
 import 'package:stack_trace/stack_trace.dart';
@@ -12,6 +11,7 @@
 import 'src/base/config.dart';
 import 'src/base/context.dart';
 import 'src/base/file_system.dart';
+import 'src/base/io.dart';
 import 'src/base/logger.dart';
 import 'src/base/os.dart';
 import 'src/base/process.dart';
@@ -125,9 +125,9 @@
       _exit(0);
     }, onError: (dynamic error, Chain chain) {
       if (error is UsageException) {
-        io.stderr.writeln(error.message);
-        io.stderr.writeln();
-        io.stderr.writeln(
+        stderr.writeln(error.message);
+        stderr.writeln();
+        stderr.writeln(
             "Run 'flutter -h' (or 'flutter <command> -h') for available "
                 "flutter commands and options."
         );
@@ -135,11 +135,11 @@
         _exit(64);
       } else if (error is ToolExit) {
         if (error.message != null)
-          io.stderr.writeln(error.message);
+          stderr.writeln(error.message);
         if (verbose) {
-          io.stderr.writeln();
-          io.stderr.writeln(chain.terse.toString());
-          io.stderr.writeln();
+          stderr.writeln();
+          stderr.writeln(chain.terse.toString());
+          stderr.writeln();
         }
         _exit(error.exitCode ?? 1);
       } else if (error is ProcessExit) {
@@ -147,23 +147,23 @@
         _exit(error.exitCode);
       } else {
         // We've crashed; emit a log report.
-        io.stderr.writeln();
+        stderr.writeln();
 
         flutterUsage.sendException(error, chain);
 
         if (isRunningOnBot) {
           // Print the stack trace on the bots - don't write a crash report.
-          io.stderr.writeln('$error');
-          io.stderr.writeln(chain.terse.toString());
+          stderr.writeln('$error');
+          stderr.writeln(chain.terse.toString());
           _exit(1);
         } else {
           if (error is String)
-            io.stderr.writeln('Oops; flutter has exited unexpectedly: "$error".');
+            stderr.writeln('Oops; flutter has exited unexpectedly: "$error".');
           else
-            io.stderr.writeln('Oops; flutter has exited unexpectedly.');
+            stderr.writeln('Oops; flutter has exited unexpectedly.');
 
           _createCrashReport(args, error, chain).then((File file) {
-            io.stderr.writeln(
+            stderr.writeln(
                 'Crash report written to ${file.path};\n'
                     'please let us know at https://github.com/flutter/flutter/issues.'
             );
diff --git a/packages/flutter_tools/lib/src/android/adb.dart b/packages/flutter_tools/lib/src/android/adb.dart
index 2148459..1c539a2 100644
--- a/packages/flutter_tools/lib/src/android/adb.dart
+++ b/packages/flutter_tools/lib/src/android/adb.dart
@@ -3,8 +3,8 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
+import '../base/io.dart';
 import '../base/process.dart';
 import '../globals.dart';
 
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index cda0f21..be0df64 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -4,11 +4,11 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 
 import '../android/android_sdk.dart';
 import '../application_package.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/logger.dart';
 import '../base/os.dart';
 import '../base/process.dart';
@@ -61,7 +61,7 @@
       try {
         // We pass an encoding of LATIN1 so that we don't try and interpret the
         // `adb shell getprop` result as UTF8.
-        io.ProcessResult result = processManager.runSync(
+        ProcessResult result = processManager.runSync(
           propCommand.first,
           propCommand.sublist(1),
           stdoutEncoding: LATIN1
@@ -559,7 +559,7 @@
   final AndroidDevice device;
 
   StreamController<String> _linesController;
-  io.Process _process;
+  Process _process;
 
   @override
   Stream<String> get logLines => _linesController.stream;
@@ -585,7 +585,7 @@
         _timeOrigin = _adbTimestampToDateTime(lastTimestamp);
     else
         _timeOrigin = null;
-    runCommand(device.adbCommandForDevice(args)).then((io.Process process) {
+    runCommand(device.adbCommandForDevice(args)).then((Process process) {
       _process = process;
       _process.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
       _process.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
diff --git a/packages/flutter_tools/lib/src/android/android_sdk.dart b/packages/flutter_tools/lib/src/android/android_sdk.dart
index 832d7fe..6b13313 100644
--- a/packages/flutter_tools/lib/src/android/android_sdk.dart
+++ b/packages/flutter_tools/lib/src/android/android_sdk.dart
@@ -2,14 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io' as io;
-
 import 'package:path/path.dart' as path;
 import 'package:pub_semver/pub_semver.dart';
 
 import '../base/common.dart';
 import '../base/context.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/os.dart';
 import '../globals.dart';
 
@@ -65,12 +64,12 @@
 
   static AndroidSdk locateAndroidSdk() {
     String androidHomeDir;
-    if (io.Platform.environment.containsKey(kAndroidHome)) {
-      androidHomeDir = io.Platform.environment[kAndroidHome];
-    } else if (io.Platform.isLinux) {
+    if (Platform.environment.containsKey(kAndroidHome)) {
+      androidHomeDir = Platform.environment[kAndroidHome];
+    } else if (Platform.isLinux) {
       if (homeDirPath != null)
         androidHomeDir = '$homeDirPath/Android/Sdk';
-    } else if (io.Platform.isMacOS) {
+    } else if (Platform.isMacOS) {
       if (homeDirPath != null)
         androidHomeDir = '$homeDirPath/Library/Android/sdk';
     }
diff --git a/packages/flutter_tools/lib/src/android/android_workflow.dart b/packages/flutter_tools/lib/src/android/android_workflow.dart
index 58f77db..9a570f5 100644
--- a/packages/flutter_tools/lib/src/android/android_workflow.dart
+++ b/packages/flutter_tools/lib/src/android/android_workflow.dart
@@ -3,8 +3,8 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
+import '../base/io.dart';
 import '../base/os.dart';
 import '../base/process_manager.dart';
 import '../doctor.dart';
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index 3a5729f..9ebd53b 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -4,13 +4,13 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 
 import 'package:json_schema/json_schema.dart';
 import 'package:path/path.dart' as path;
 import 'package:yaml/yaml.dart';
 
 import 'base/file_system.dart';
+import 'base/io.dart';
 import 'build_info.dart';
 import 'cache.dart';
 import 'dart/package_map.dart';
@@ -378,7 +378,7 @@
     return result;
 
   excludeDirs = excludeDirs.map(
-    (String exclude) => path.absolute(exclude) + io.Platform.pathSeparator).toList();
+    (String exclude) => path.absolute(exclude) + Platform.pathSeparator).toList();
 
   if (manifestDescriptor.containsKey('assets')) {
     for (String asset in manifestDescriptor['assets']) {
diff --git a/packages/flutter_tools/lib/src/base/common.dart b/packages/flutter_tools/lib/src/base/common.dart
index 0e3f867..32ca620 100644
--- a/packages/flutter_tools/lib/src/base/common.dart
+++ b/packages/flutter_tools/lib/src/base/common.dart
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io';
-
 import 'package:path/path.dart' as path;
 
+import 'io.dart';
+
 const int kDefaultObservatoryPort = 8100;
 const int kDefaultDiagnosticPort  = 8101;
 const int kDefaultDrivePort       = 8183;
diff --git a/packages/flutter_tools/lib/src/base/config.dart b/packages/flutter_tools/lib/src/base/config.dart
index 1bae133..dc10ae2 100644
--- a/packages/flutter_tools/lib/src/base/config.dart
+++ b/packages/flutter_tools/lib/src/base/config.dart
@@ -3,12 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:convert';
-import 'dart:io' as io;
 
 import 'package:path/path.dart' as path;
 
 import 'context.dart';
 import 'file_system.dart';
+import 'io.dart';
 
 class Config {
   Config([File configFile]) {
@@ -46,7 +46,7 @@
 }
 
 String _userHomeDir() {
-  String envKey = io.Platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
-  String value = io.Platform.environment[envKey];
+  String envKey = Platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
+  String value = Platform.environment[envKey];
   return value == null ? '.' : value;
 }
diff --git a/packages/flutter_tools/lib/src/base/file_system.dart b/packages/flutter_tools/lib/src/base/file_system.dart
index b3d9ce9..5fd2ed8 100644
--- a/packages/flutter_tools/lib/src/base/file_system.dart
+++ b/packages/flutter_tools/lib/src/base/file_system.dart
@@ -2,12 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io' as io;
-
 import 'package:file/file.dart';
 import 'package:file/local.dart';
 import 'package:file/memory.dart';
-import 'package:meta/meta.dart';
 import 'package:path/path.dart' as path;
 
 import 'context.dart';
@@ -23,41 +20,11 @@
 /// with [MemoryFileSystem].
 FileSystem get fs => context == null ? _kLocalFs : context[FileSystem];
 
-/// Exits the process with the given [exitCode].
-typedef void ExitFunction([int exitCode]);
-
-final ExitFunction _defaultExitFunction = ([int exitCode]) {
-  io.exit(exitCode);
-};
-
-ExitFunction _exitFunction = _defaultExitFunction;
-
-/// Exits the process.
-///
-/// During tests, this may be set to a testing-friendly value by calling
-/// [setExitFunctionForTests] (and then restored with [restoreExitFunction]).
-ExitFunction get exit => _exitFunction;
-
-/// Sets the [exit] function to a function that throws an exception rather
-/// than exiting the process; intended for testing purposes.
-@visibleForTesting
-void setExitFunctionForTests([ExitFunction exitFunction]) {
-  _exitFunction = exitFunction ?? ([int exitCode]) {
-    throw new Exception('Exited with code $exitCode');
-  };
-}
-
-/// Restores the [exit] function to the `dart:io` implementation.
-@visibleForTesting
-void restoreExitFunction() {
-  _exitFunction = _defaultExitFunction;
-}
-
 /// Create the ancestor directories of a file path if they do not already exist.
 void ensureDirectoryExists(String filePath) {
   String dirPath = path.dirname(filePath);
 
-  if (fs.typeSync(dirPath) == FileSystemEntityType.DIRECTORY)
+  if (fs.isDirectorySync(dirPath))
     return;
   fs.directory(dirPath).createSync(recursive: true);
 }
diff --git a/packages/flutter_tools/lib/src/base/io.dart b/packages/flutter_tools/lib/src/base/io.dart
new file mode 100644
index 0000000..9b2d717
--- /dev/null
+++ b/packages/flutter_tools/lib/src/base/io.dart
@@ -0,0 +1,89 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/// This file serves as the single point of entry into the `dart:io` APIs
+/// within Flutter tools.
+///
+/// In order to make Flutter tools more testable, we use the `FileSystem` APIs
+/// in `package:file` rather than using the `dart:io` file APIs directly (see
+/// `file_system.dart`). Doing so allows us to swap out local file system
+/// access with mockable (or in-memory) file systems, making our tests hermetic
+/// vis-a-vis file system access.
+///
+/// To ensure that all file system access within Flutter tools goes through the
+/// proper APIs, we forbid direct imports of `dart:io` (via a test), forcing
+/// all callers to instead import this file, which exports the blessed subset
+/// of `dart:io` that is legal to use in Flutter tools.
+///
+/// Because of the nature of this file, it is important that **no file APIs
+/// be exported from `dart:io` in this file**! Moreover, be careful about any
+/// additional exports that you add to this file, as doing so will increase the
+/// API surface that we have to test in Flutter tools, and the APIs in `dart:io`
+/// can sometimes be hard to use in tests.
+import 'dart:io' as io show exit, exitCode;
+
+import 'package:meta/meta.dart';
+
+export 'dart:io'
+    show
+        BytesBuilder,
+        exitCode,
+        GZIP,
+        InternetAddress,
+        IOException,
+        IOSink,
+        HttpClient,
+        HttpClientRequest,
+        HttpClientResponse,
+        HttpHeaders,
+        HttpRequest,
+        HttpServer,
+        HttpStatus,
+        pid,
+        Platform,
+        Process,
+        ProcessException,
+        ProcessResult,
+        ProcessSignal,
+        ProcessStartMode,
+        ServerSocket,
+        stderr,
+        stdin,
+        stdout,
+        Socket,
+        SocketException,
+        SYSTEM_ENCODING,
+        WebSocket,
+        WebSocketTransformer;
+
+/// Exits the process with the given [exitCode].
+typedef void ExitFunction(int exitCode);
+
+final ExitFunction _defaultExitFunction = (int exitCode) => io.exit(exitCode);
+
+ExitFunction _exitFunction = _defaultExitFunction;
+
+/// Exits the process.
+///
+/// This is analogous to the `exit` function in `dart:io`, except that this
+/// function may be set to a testing-friendly value by calling
+/// [setExitFunctionForTests] (and then restored to its default implementation
+/// with [restoreExitFunction]). The default implementation delegates to
+/// `dart:io`.
+ExitFunction get exit => _exitFunction;
+
+/// Sets the [exit] function to a function that throws an exception rather
+/// than exiting the process; this is intended for testing purposes.
+@visibleForTesting
+void setExitFunctionForTests([ExitFunction exitFunction]) {
+  _exitFunction = exitFunction ?? (int exitCode) {
+    throw new Exception('Exited with code ${io.exitCode}');
+  };
+}
+
+/// Restores the [exit] function to the `dart:io` implementation.
+@visibleForTesting
+void restoreExitFunction() {
+  _exitFunction = _defaultExitFunction;
+}
diff --git a/packages/flutter_tools/lib/src/base/logger.dart b/packages/flutter_tools/lib/src/base/logger.dart
index c86f064..bd10a17 100644
--- a/packages/flutter_tools/lib/src/base/logger.dart
+++ b/packages/flutter_tools/lib/src/base/logger.dart
@@ -4,10 +4,11 @@
 
 import 'dart:async';
 import 'dart:convert' show ASCII;
-import 'dart:io';
 
 import 'package:stack_trace/stack_trace.dart';
 
+import 'io.dart';
+
 final AnsiTerminal terminal = new AnsiTerminal();
 
 abstract class Logger {
diff --git a/packages/flutter_tools/lib/src/base/net.dart b/packages/flutter_tools/lib/src/base/net.dart
index 7734bde..0fd3b70 100644
--- a/packages/flutter_tools/lib/src/base/net.dart
+++ b/packages/flutter_tools/lib/src/base/net.dart
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import '../globals.dart';
 import 'common.dart';
+import 'io.dart';
 
 const int kNetworkProblemExitCode = 50;
 
diff --git a/packages/flutter_tools/lib/src/base/os.dart b/packages/flutter_tools/lib/src/base/os.dart
index 96ba3ec..7b9fb6e 100644
--- a/packages/flutter_tools/lib/src/base/os.dart
+++ b/packages/flutter_tools/lib/src/base/os.dart
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:archive/archive.dart';
 import 'package:path/path.dart' as path;
 
 import 'context.dart';
 import 'file_system.dart';
+import 'io.dart';
 import 'process.dart';
 import 'process_manager.dart';
 
@@ -18,7 +18,7 @@
 
 abstract class OperatingSystemUtils {
   factory OperatingSystemUtils() {
-    if (io.Platform.isWindows) {
+    if (Platform.isWindows) {
       return new _WindowsUtils();
     } else {
       return new _PosixUtils();
@@ -27,14 +27,14 @@
 
   OperatingSystemUtils._private();
 
-  String get operatingSystem => io.Platform.operatingSystem;
+  String get operatingSystem => Platform.operatingSystem;
 
   bool get isMacOS => operatingSystem == 'macos';
   bool get isWindows => operatingSystem == 'windows';
   bool get isLinux => operatingSystem == 'linux';
 
   /// Make the given file executable. This may be a no-op on some platforms.
-  io.ProcessResult makeExecutable(File file);
+  ProcessResult makeExecutable(File file);
 
   /// Return the path (with symlinks resolved) to the given executable, or `null`
   /// if `which` was not able to locate the binary.
@@ -50,7 +50,7 @@
   _PosixUtils() : super._private();
 
   @override
-  io.ProcessResult makeExecutable(File file) {
+  ProcessResult makeExecutable(File file) {
     return processManager.runSync('chmod', <String>['a+x', file.path]);
   }
 
@@ -58,7 +58,7 @@
   /// to locate the binary.
   @override
   File which(String execName) {
-    io.ProcessResult result = processManager.runSync('which', <String>[execName]);
+    ProcessResult result = processManager.runSync('which', <String>[execName]);
     if (result.exitCode != 0)
       return null;
     String path = result.stdout.trim().split('\n').first.trim();
@@ -83,13 +83,13 @@
 
   // This is a no-op.
   @override
-  io.ProcessResult makeExecutable(File file) {
-    return new io.ProcessResult(0, 0, null, null);
+  ProcessResult makeExecutable(File file) {
+    return new ProcessResult(0, 0, null, null);
   }
 
   @override
   File which(String execName) {
-    io.ProcessResult result = processManager.runSync('where', <String>[execName]);
+    ProcessResult result = processManager.runSync('where', <String>[execName]);
     if (result.exitCode != 0)
       return null;
     return fs.file(result.stdout.trim().split('\n').first.trim());
@@ -118,7 +118,7 @@
 }
 
 Future<int> findAvailablePort() async {
-  io.ServerSocket socket = await io.ServerSocket.bind(io.InternetAddress.LOOPBACK_IP_V4, 0);
+  ServerSocket socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0);
   int port = socket.port;
   await socket.close();
   return port;
@@ -143,7 +143,7 @@
 
 Future<bool> _isPortAvailable(int port) async {
   try {
-    io.ServerSocket socket = await io.ServerSocket.bind(io.InternetAddress.LOOPBACK_IP_V4, port);
+    ServerSocket socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, port);
     await socket.close();
     return true;
   } catch (error) {
diff --git a/packages/flutter_tools/lib/src/base/process.dart b/packages/flutter_tools/lib/src/base/process.dart
index 0f8edc5..4b57b97 100644
--- a/packages/flutter_tools/lib/src/base/process.dart
+++ b/packages/flutter_tools/lib/src/base/process.dart
@@ -4,8 +4,8 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
 
+import 'io.dart';
 import 'process_manager.dart';
 import '../globals.dart';
 
diff --git a/packages/flutter_tools/lib/src/base/process_manager.dart b/packages/flutter_tools/lib/src/base/process_manager.dart
index 1641d67..3fd8a1b 100644
--- a/packages/flutter_tools/lib/src/base/process_manager.dart
+++ b/packages/flutter_tools/lib/src/base/process_manager.dart
@@ -4,14 +4,14 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 
 import 'package:archive/archive.dart';
 import 'package:intl/intl.dart';
 import 'package:path/path.dart' as path;
 
 import 'context.dart';
-import 'file_system.dart';
+import 'file_system.dart' hide IOSink;
+import 'io.dart';
 import 'os.dart';
 import 'process.dart';
 
@@ -32,14 +32,14 @@
 /// methods to allow the implementation of these methods to be mocked out or
 /// decorated for testing or debugging purposes.
 class ProcessManager {
-  Future<io.Process> start(
+  Future<Process> start(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    io.ProcessStartMode mode: io.ProcessStartMode.NORMAL,
+    ProcessStartMode mode: ProcessStartMode.NORMAL,
   }) {
-    return io.Process.start(
+    return Process.start(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -48,15 +48,15 @@
     );
   }
 
-  Future<io.ProcessResult> run(
+  Future<ProcessResult> run(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
-    Encoding stderrEncoding: io.SYSTEM_ENCODING,
+    Encoding stdoutEncoding: SYSTEM_ENCODING,
+    Encoding stderrEncoding: SYSTEM_ENCODING,
   }) {
-    return io.Process.run(
+    return Process.run(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -66,15 +66,15 @@
     );
   }
 
-  io.ProcessResult runSync(
+  ProcessResult runSync(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
-    Encoding stderrEncoding: io.SYSTEM_ENCODING,
+    Encoding stdoutEncoding: SYSTEM_ENCODING,
+    Encoding stderrEncoding: SYSTEM_ENCODING,
   }) {
-    return io.Process.runSync(
+    return Process.runSync(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -84,8 +84,8 @@
     );
   }
 
-  bool killPid(int pid, [io.ProcessSignal signal = io.ProcessSignal.SIGTERM]) {
-    return io.Process.killPid(pid, signal);
+  bool killPid(int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]) {
+    return Process.killPid(pid, signal);
   }
 }
 
@@ -122,14 +122,14 @@
   }
 
   @override
-  Future<io.Process> start(
+  Future<Process> start(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    io.ProcessStartMode mode: io.ProcessStartMode.NORMAL,
+    ProcessStartMode mode: ProcessStartMode.NORMAL,
   }) async {
-    io.Process process = await _delegate.start(
+    Process process = await _delegate.start(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -164,15 +164,15 @@
   }
 
   @override
-  Future<io.ProcessResult> run(
+  Future<ProcessResult> run(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
-    Encoding stderrEncoding: io.SYSTEM_ENCODING,
+    Encoding stdoutEncoding: SYSTEM_ENCODING,
+    Encoding stderrEncoding: SYSTEM_ENCODING,
   }) async {
-    io.ProcessResult result = await _delegate.run(
+    ProcessResult result = await _delegate.run(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -216,15 +216,15 @@
   }
 
   @override
-  io.ProcessResult runSync(
+  ProcessResult runSync(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
-    Encoding stderrEncoding: io.SYSTEM_ENCODING,
+    Encoding stdoutEncoding: SYSTEM_ENCODING,
+    Encoding stderrEncoding: SYSTEM_ENCODING,
   }) {
-    io.ProcessResult result = _delegate.runSync(
+    ProcessResult result = _delegate.runSync(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -268,7 +268,7 @@
   }
 
   @override
-  bool killPid(int pid, [io.ProcessSignal signal = io.ProcessSignal.SIGTERM]) {
+  bool killPid(int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]) {
     return _delegate.killPid(pid, signal);
   }
 
@@ -281,7 +281,7 @@
     List<String> arguments,
     String workingDirectory,
     Map<String, String> environment,
-    io.ProcessStartMode mode,
+    ProcessStartMode mode,
     Encoding stdoutEncoding,
     Encoding stderrEncoding,
     int exitCode,
@@ -332,7 +332,7 @@
     await _waitForRunningProcessesToExitWithTimeout(
       onTimeout: (int pid, Map<String, dynamic> manifestEntry) {
         manifestEntry['daemon'] = true;
-        io.Process.killPid(pid);
+        Process.killPid(pid);
       });
     // Now that we explicitly signalled the processes that timed out asking
     // them to shutdown, wait one more time for those processes to exit.
@@ -438,8 +438,8 @@
 
 /// A [Process] implementation that records `stdout` and `stderr` stream events
 /// to disk before forwarding them on to the underlying stream listener.
-class _RecordingProcess implements io.Process {
-  final io.Process delegate;
+class _RecordingProcess implements Process {
+  final Process delegate;
   final String basename;
   final RecordingProcessManager manager;
 
@@ -507,7 +507,7 @@
   }
 
   @override
-  io.IOSink get stdin {
+  IOSink get stdin {
     // We don't currently support recording `stdin`.
     return delegate.stdin;
   }
@@ -516,7 +516,7 @@
   int get pid => delegate.pid;
 
   @override
-  bool kill([io.ProcessSignal signal = io.ProcessSignal.SIGTERM]) => delegate.kill(signal);
+  bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]) => delegate.kill(signal);
 }
 
 /// A [ProcessManager] implementation that mocks out all process invocations
@@ -609,12 +609,12 @@
   }
 
   @override
-  Future<io.Process> start(
+  Future<Process> start(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    io.ProcessStartMode mode: io.ProcessStartMode.NORMAL,
+    ProcessStartMode mode: ProcessStartMode.NORMAL,
   }) async {
     Map<String, dynamic> entry = _popEntry(executable, arguments, mode: mode);
     _ReplayProcessResult result = await _ReplayProcessResult.create(
@@ -623,13 +623,13 @@
   }
 
   @override
-  Future<io.ProcessResult> run(
+  Future<ProcessResult> run(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
-    Encoding stderrEncoding: io.SYSTEM_ENCODING,
+    Encoding stdoutEncoding: SYSTEM_ENCODING,
+    Encoding stderrEncoding: SYSTEM_ENCODING,
   }) async {
     Map<String, dynamic> entry = _popEntry(executable, arguments,
         stdoutEncoding: stdoutEncoding, stderrEncoding: stderrEncoding);
@@ -638,13 +638,13 @@
   }
 
   @override
-  io.ProcessResult runSync(
+  ProcessResult runSync(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
-    Encoding stderrEncoding: io.SYSTEM_ENCODING,
+    Encoding stdoutEncoding: SYSTEM_ENCODING,
+    Encoding stderrEncoding: SYSTEM_ENCODING,
   }) {
     Map<String, dynamic> entry = _popEntry(executable, arguments,
         stdoutEncoding: stdoutEncoding, stderrEncoding: stderrEncoding);
@@ -656,7 +656,7 @@
   /// the specified process arguments. Once found, it marks the manifest entry
   /// as having been invoked and thus not eligible for invocation again.
   Map<String, dynamic> _popEntry(String executable, List<String> arguments, {
-    io.ProcessStartMode mode,
+    ProcessStartMode mode,
     Encoding stdoutEncoding,
     Encoding stderrEncoding,
   }) {
@@ -675,14 +675,14 @@
     );
 
     if (entry == null)
-      throw new io.ProcessException(executable, arguments, 'No matching invocation found');
+      throw new ProcessException(executable, arguments, 'No matching invocation found');
 
     entry['invoked'] = true;
     return entry;
   }
 
   @override
-  bool killPid(int pid, [io.ProcessSignal signal = io.ProcessSignal.SIGTERM]) {
+  bool killPid(int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]) {
     throw new UnsupportedError(
         "$runtimeType.killPid() has not been implemented because at the time "
         "of its writing, it wasn't needed. If you're hitting this error, you "
@@ -692,7 +692,7 @@
 
 /// A [ProcessResult] implementation that derives its data from a recording
 /// fragment.
-class _ReplayProcessResult implements io.ProcessResult {
+class _ReplayProcessResult implements ProcessResult {
   @override
   final int pid;
 
@@ -722,7 +722,7 @@
         stderr: await _getData('$basePath.stderr', entry['stderrEncoding']),
       );
     } catch (e) {
-      throw new io.ProcessException(executable, arguments, e.toString());
+      throw new ProcessException(executable, arguments, e.toString());
     }
   }
 
@@ -748,7 +748,7 @@
         stderr: _getDataSync('$basePath.stderr', entry['stderrEncoding']),
       );
     } catch (e) {
-      throw new io.ProcessException(executable, arguments, e.toString());
+      throw new ProcessException(executable, arguments, e.toString());
     }
   }
 
@@ -761,13 +761,13 @@
 
   static Encoding _getEncodingByName(String encoding) {
     if (encoding == 'system')
-      return const io.SystemEncoding();
+      return SYSTEM_ENCODING;
     else if (encoding != null)
       return Encoding.getByName(encoding);
     return null;
   }
 
-  io.Process asProcess(bool daemon) {
+  Process asProcess(bool daemon) {
     assert(stdout is List<int>);
     assert(stderr is List<int>);
     return new _ReplayProcess(this, daemon);
@@ -775,7 +775,7 @@
 }
 
 /// A [Process] implementation derives its data from a recording fragment.
-class _ReplayProcess implements io.Process {
+class _ReplayProcess implements Process {
   @override
   final int pid;
 
@@ -831,10 +831,10 @@
   set exitCode(Future<int> exitCode) => throw new UnsupportedError('set exitCode');
 
   @override
-  io.IOSink get stdin => throw new UnimplementedError();
+  IOSink get stdin => throw new UnimplementedError();
 
   @override
-  bool kill([io.ProcessSignal signal = io.ProcessSignal.SIGTERM]) {
+  bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]) {
     if (!_exitCodeCompleter.isCompleted) {
       _stdoutController.close();
       _stderrController.close();
diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart
index 8af34bd..4a05be2 100644
--- a/packages/flutter_tools/lib/src/base/utils.dart
+++ b/packages/flutter_tools/lib/src/base/utils.dart
@@ -4,21 +4,21 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 import 'dart:math' show Random;
 
 import 'package:crypto/crypto.dart';
 import 'package:path/path.dart' as path;
 
 import 'file_system.dart';
+import 'io.dart';
 
 bool get isRunningOnBot {
   // https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
   // CHROME_HEADLESS is one property set on Flutter's Chrome Infra bots.
   return
-    io.Platform.environment['TRAVIS'] == 'true' ||
-    io.Platform.environment['CONTINUOUS_INTEGRATION'] == 'true' ||
-    io.Platform.environment['CHROME_HEADLESS'] == '1';
+    Platform.environment['TRAVIS'] == 'true' ||
+    Platform.environment['CONTINUOUS_INTEGRATION'] == 'true' ||
+    Platform.environment['CHROME_HEADLESS'] == '1';
 }
 
 String hex(List<int> bytes) {
@@ -93,7 +93,7 @@
 /// Return a relative path if [fullPath] is contained by the cwd, else return an
 /// absolute path.
 String getDisplayPath(String fullPath) {
-  String cwd = fs.currentDirectory.path + io.Platform.pathSeparator;
+  String cwd = fs.currentDirectory.path + Platform.pathSeparator;
   return fullPath.startsWith(cwd) ?  fullPath.substring(cwd.length) : fullPath;
 }
 
diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart
index 8d8eb87..e4305e3 100644
--- a/packages/flutter_tools/lib/src/build_info.dart
+++ b/packages/flutter_tools/lib/src/build_info.dart
@@ -2,11 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io';
-
 import 'package:path/path.dart' as path;
 
 import 'base/context.dart';
+import 'base/io.dart';
 import 'base/utils.dart';
 import 'globals.dart';
 
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
index 9c898a4..4fe4b7e 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:flutter_tools/src/dart/pub.dart';
 import 'package:flutter_tools/src/dart/summary.dart';
@@ -11,6 +10,7 @@
 
 import 'base/context.dart';
 import 'base/file_system.dart';
+import 'base/io.dart';
 import 'base/logger.dart';
 import 'base/net.dart';
 import 'base/os.dart';
@@ -84,7 +84,7 @@
 
   static String get dartSdkVersion {
     if (_dartSdkVersion == null) {
-      _dartSdkVersion = io.Platform.version;
+      _dartSdkVersion = Platform.version;
     }
     return _dartSdkVersion;
   }
@@ -264,9 +264,9 @@
 
     if (cache.includeAllPlatforms)
       dirs.addAll(<String>['ios', 'ios-profile', 'ios-release', 'linux-x64']);
-    else if (io.Platform.isMacOS)
+    else if (Platform.isMacOS)
       dirs.addAll(<String>['ios', 'ios-profile', 'ios-release']);
-    else if (io.Platform.isLinux)
+    else if (Platform.isLinux)
       dirs.add('linux-x64');
 
     return dirs;
@@ -278,9 +278,9 @@
       return <List<String>>[]
         ..addAll(_osxToolsDirs)
         ..addAll(_linuxToolsDirs);
-    else if (io.Platform.isMacOS)
+    else if (Platform.isMacOS)
       return _osxToolsDirs;
-    else if (io.Platform.isLinux)
+    else if (Platform.isLinux)
       return _linuxToolsDirs;
     else
       return <List<String>>[];
diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart
index 69768ad..c602361 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_base.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart
@@ -3,12 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:args/args.dart';
 import 'package:path/path.dart' as path;
 
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/utils.dart';
 import '../cache.dart';
 import '../globals.dart';
@@ -59,7 +59,7 @@
   if (fileList == null || fileList.isEmpty)
     fileList = <String>[path.current];
   String root = path.normalize(path.absolute(Cache.flutterRoot));
-  String prefix = root + io.Platform.pathSeparator;
+  String prefix = root + Platform.pathSeparator;
   for (String file in fileList) {
     file = path.normalize(path.absolute(file));
     if (file == root || file.startsWith(prefix))
diff --git a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
index 23ce702..de0cac3 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
@@ -4,13 +4,13 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 
 import 'package:args/args.dart';
 import 'package:path/path.dart' as path;
 
 import '../base/common.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/logger.dart';
 import '../base/process_manager.dart';
 import '../base/utils.dart';
@@ -150,7 +150,7 @@
   final String sdk;
   final List<String> directories;
 
-  io.Process _process;
+  Process _process;
   StreamController<bool> _analyzingController = new StreamController<bool>.broadcast();
   StreamController<FileAnalysisErrors> _errorsController = new StreamController<FileAnalysisErrors>.broadcast();
 
diff --git a/packages/flutter_tools/lib/src/commands/build.dart b/packages/flutter_tools/lib/src/commands/build.dart
index 1957d85..9c52c66 100644
--- a/packages/flutter_tools/lib/src/commands/build.dart
+++ b/packages/flutter_tools/lib/src/commands/build.dart
@@ -3,16 +3,16 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:meta/meta.dart';
 
+import '../base/common.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
+import '../base/utils.dart';
 import '../build_info.dart';
 import '../globals.dart';
 import '../runner/flutter_command.dart';
-import '../base/common.dart';
-import '../base/utils.dart';
 import 'build_apk.dart';
 import 'build_aot.dart';
 import 'build_flx.dart';
@@ -88,7 +88,7 @@
   @override
   Future<Null> runCommand() async {
     Directory buildDir = fs.directory(getBuildDirectory());
-    printStatus("Deleting '${buildDir.path}${io.Platform.pathSeparator}'.");
+    printStatus("Deleting '${buildDir.path}${Platform.pathSeparator}'.");
 
     if (!buildDir.existsSync())
       return;
diff --git a/packages/flutter_tools/lib/src/commands/build_aot.dart b/packages/flutter_tools/lib/src/commands/build_aot.dart
index f8e8c44..3ebedda 100644
--- a/packages/flutter_tools/lib/src/commands/build_aot.dart
+++ b/packages/flutter_tools/lib/src/commands/build_aot.dart
@@ -3,12 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:path/path.dart' as path;
 
 import '../base/common.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/logger.dart';
 import '../base/process.dart';
 import '../base/utils.dart';
@@ -65,7 +65,7 @@
     if (outputPath == null)
       throwToolExit(null);
 
-    printStatus('Built to $outputPath${io.Platform.pathSeparator}.');
+    printStatus('Built to $outputPath${Platform.pathSeparator}.');
   }
 }
 
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart
index 4f7483d..50a6de8 100644
--- a/packages/flutter_tools/lib/src/commands/daemon.dart
+++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -4,12 +4,12 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 
 import '../android/android_device.dart';
 import '../base/common.dart';
 import '../base/context.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/logger.dart';
 import '../base/utils.dart';
 import '../build_info.dart';
@@ -120,7 +120,7 @@
     dynamic id = request['id'];
 
     if (id == null) {
-      io.stderr.writeln('no id for request: $request');
+      stderr.writeln('no id for request: $request');
       return;
     }
 
@@ -235,9 +235,9 @@
           // capture the print output for testing.
           print(message.message);
         } else if (message.level == 'error') {
-          io.stderr.writeln(message.message);
+          stderr.writeln(message.message);
           if (message.stackTrace != null)
-            io.stderr.writeln(message.stackTrace.toString().trimRight());
+            stderr.writeln(message.stackTrace.toString().trimRight());
         }
       } else {
         if (message.stackTrace != null) {
@@ -590,7 +590,7 @@
   }
 }
 
-Stream<Map<String, dynamic>> get stdinCommandStream => io.stdin
+Stream<Map<String, dynamic>> get stdinCommandStream => stdin
   .transform(UTF8.decoder)
   .transform(const LineSplitter())
   .where((String line) => line.startsWith('[{') && line.endsWith('}]'))
@@ -600,7 +600,7 @@
   });
 
 void stdoutCommandResponse(Map<String, dynamic> command) {
-  io.stdout.writeln('[${JSON.encode(command, toEncodable: _jsonEncodeObject)}]');
+  stdout.writeln('[${JSON.encode(command, toEncodable: _jsonEncodeObject)}]');
 }
 
 dynamic _jsonEncodeObject(dynamic object) {
@@ -710,9 +710,9 @@
   @override
   void printError(String message, [StackTrace stackTrace]) {
     if (logToStdout) {
-      io.stderr.writeln(message);
+      stderr.writeln(message);
       if (stackTrace != null)
-        io.stderr.writeln(stackTrace.toString().trimRight());
+        stderr.writeln(stackTrace.toString().trimRight());
     } else {
       if (stackTrace != null) {
         _sendLogEvent(<String, dynamic>{
diff --git a/packages/flutter_tools/lib/src/commands/logs.dart b/packages/flutter_tools/lib/src/commands/logs.dart
index fc61737..ae9f259 100644
--- a/packages/flutter_tools/lib/src/commands/logs.dart
+++ b/packages/flutter_tools/lib/src/commands/logs.dart
@@ -3,9 +3,9 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import '../base/common.dart';
+import '../base/io.dart';
 import '../cache.dart';
 import '../device.dart';
 import '../globals.dart';
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index 7486648..2126df3 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import '../base/common.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/utils.dart';
 import '../build_info.dart';
 import '../cache.dart';
@@ -218,7 +218,7 @@
     String pidFile = argResults['pid-file'];
     if (pidFile != null) {
       // Write our pid to the file.
-      fs.file(pidFile).writeAsStringSync(io.pid.toString());
+      fs.file(pidFile).writeAsStringSync(pid.toString());
     }
     ResidentRunner runner;
 
diff --git a/packages/flutter_tools/lib/src/commands/screenshot.dart b/packages/flutter_tools/lib/src/commands/screenshot.dart
index 398d213..6ab9a64 100644
--- a/packages/flutter_tools/lib/src/commands/screenshot.dart
+++ b/packages/flutter_tools/lib/src/commands/screenshot.dart
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:http/http.dart' as http;
 import 'package:path/path.dart' as path;
 
 import '../base/common.dart';
 import '../base/file_system.dart';
+import '../base/io.dart' hide IOSink;
 import '../base/utils.dart';
 import '../device.dart';
 import '../globals.dart';
@@ -106,10 +106,10 @@
     http.StreamedResponse skpResponse;
     try {
       skpResponse = await new http.Request('GET', skpUri).send();
-    } on io.SocketException catch (e) {
+    } on SocketException catch (e) {
       throwToolExit('Skia screenshot failed: $skpUri\n$e\n\n$errorHelpText');
     }
-    if (skpResponse.statusCode != io.HttpStatus.OK) {
+    if (skpResponse.statusCode != HttpStatus.OK) {
       String error = await skpResponse.stream.toStringStream().join();
       throwToolExit('Error: $error\n\n$errorHelpText');
     }
@@ -122,7 +122,7 @@
           'file', skpResponse.stream, skpResponse.contentLength));
 
       http.StreamedResponse postResponse = await postRequest.send();
-      if (postResponse.statusCode != io.HttpStatus.OK)
+      if (postResponse.statusCode != HttpStatus.OK)
         throwToolExit('Failed to post Skia picture to skiaserve.\n\n$errorHelpText');
     } else {
       outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'skp');
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index 11e4a2b..d0fcf7f 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:path/path.dart' as path;
 import 'package:test/src/executable.dart' as test; // ignore: implementation_imports
 
 import '../base/common.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/logger.dart';
 import '../base/process_manager.dart';
 import '../base/os.dart';
@@ -80,8 +80,8 @@
       printTrace('running test package with arguments: $testArgs');
       await test.main(testArgs);
       // test.main() sets dart:io's exitCode global.
-      printTrace('test package returned with exit code ${io.exitCode}');
-      return io.exitCode;
+      printTrace('test package returned with exit code $exitCode');
+      return exitCode;
     } finally {
       fs.currentDirectory = currentDirectory;
     }
@@ -128,7 +128,7 @@
       Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_tools');
       try {
         File sourceFile = coverageFile.copySync(path.join(tempDir.path, 'lcov.source.info'));
-        io.ProcessResult result = processManager.runSync('lcov', <String>[
+        ProcessResult result = processManager.runSync('lcov', <String>[
           '--add-tracefile', baseCoverageData,
           '--add-tracefile', sourceFile.path,
           '--output-file', coverageFile.path,
@@ -165,7 +165,7 @@
     if (argResults['coverage'])
       testArgs.insert(0, '--concurrency=1');
 
-    final String shellPath = tools.getHostToolPath(HostTool.SkyShell) ?? io.Platform.environment['SKY_SHELL'];
+    final String shellPath = tools.getHostToolPath(HostTool.SkyShell) ?? Platform.environment['SKY_SHELL'];
     if (!fs.isFileSync(shellPath))
       throwToolExit('Cannot find Flutter shell at $shellPath');
     loader.installHook(shellPath: shellPath);
diff --git a/packages/flutter_tools/lib/src/dart/analysis.dart b/packages/flutter_tools/lib/src/dart/analysis.dart
index 62d20b6..98a466f 100644
--- a/packages/flutter_tools/lib/src/dart/analysis.dart
+++ b/packages/flutter_tools/lib/src/dart/analysis.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:collection';
-import 'dart:io' as io;
 
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/file_system/file_system.dart' as file_system;
@@ -27,7 +26,8 @@
 import 'package:plugin/manager.dart';
 import 'package:plugin/plugin.dart';
 
-import '../base/file_system.dart';
+import '../base/file_system.dart' hide IOSink;
+import '../base/io.dart';
 
 class AnalysisDriver {
   Set<Source> _analyzedSources = new HashSet<Source>();
@@ -240,10 +240,10 @@
   Map<Object, Object> analysisOptions;
 
   /// Out sink for logging.
-  io.IOSink outSink = io.stdout;
+  IOSink outSink = stdout;
 
   /// Error sink for logging.
-  io.IOSink errorSink = io.stderr;
+  IOSink errorSink = stderr;
 }
 
 class PackageInfo {
@@ -269,8 +269,8 @@
 }
 
 class _StdLogger extends Logger {
-  final io.IOSink outSink;
-  final io.IOSink errorSink;
+  final IOSink outSink;
+  final IOSink errorSink;
   _StdLogger({this.outSink, this.errorSink});
 
   @override
diff --git a/packages/flutter_tools/lib/src/dart/sdk.dart b/packages/flutter_tools/lib/src/dart/sdk.dart
index cb782c6..92f93de 100644
--- a/packages/flutter_tools/lib/src/dart/sdk.dart
+++ b/packages/flutter_tools/lib/src/dart/sdk.dart
@@ -2,10 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io';
-
 import 'package:path/path.dart' as path;
 
+import '../base/io.dart';
 import '../cache.dart';
 
 /// Locate the Dart SDK.
diff --git a/packages/flutter_tools/lib/src/dart/summary.dart b/packages/flutter_tools/lib/src/dart/summary.dart
index e8d5a35..a7ea35a 100644
--- a/packages/flutter_tools/lib/src/dart/summary.dart
+++ b/packages/flutter_tools/lib/src/dart/summary.dart
@@ -1,5 +1,4 @@
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/physical_file_system.dart';
@@ -15,6 +14,9 @@
 import 'package:path/path.dart' as pathos;
 import 'package:yaml/src/yaml_node.dart'; // ignore: implementation_imports
 
+import '../base/file_system.dart' as file;
+import '../base/io.dart';
+
 /// Given the [skyEnginePath], locate corresponding `_embedder.yaml` and compose
 /// the full embedded Dart SDK, and build the [outBundleName] file with its
 /// linked summary.
@@ -46,13 +48,13 @@
   // Build.
   List<int> bytes = new SummaryBuilder(sources, sdk.context, true).build();
   String outputPath = pathos.join(skyEnginePath, outBundleName);
-  new io.File(outputPath).writeAsBytesSync(bytes);
+  file.fs.file(outputPath).writeAsBytesSync(bytes);
 }
 
 Future<Null> buildUnlinkedForPackages(String flutterPath) async {
   PhysicalResourceProvider provider = PhysicalResourceProvider.INSTANCE;
   PubSummaryManager manager =
-      new PubSummaryManager(provider, '__unlinked_${io.pid}.ds');
+      new PubSummaryManager(provider, '__unlinked_$pid.ds');
 
   Folder flutterFolder = provider.getFolder(flutterPath);
 
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index 9ee5834..03bd4b4 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -4,12 +4,12 @@
 
 import 'dart:async';
 import 'dart:convert' show BASE64, UTF8;
-import 'dart:io' as io;
 
 import 'package:path/path.dart' as path;
 
 import 'base/context.dart';
 import 'base/file_system.dart';
+import 'base/io.dart';
 import 'build_info.dart';
 import 'dart/package_map.dart';
 import 'asset.dart';
@@ -127,7 +127,7 @@
   }
 
   Stream<List<int>> contentsAsCompressedStream() {
-    return contentsAsStream().transform(io.GZIP.encoder);
+    return contentsAsStream().transform(GZIP.encoder);
   }
 }
 
@@ -214,13 +214,13 @@
   int _inFlight = 0;
   List<DevFSEntry> _outstanding;
   Completer<Null> _completer;
-  io.HttpClient _client;
+  HttpClient _client;
   int _done;
   int _max;
 
   Future<Null> write(Set<DevFSEntry> entries,
                      {DevFSProgressReporter progressReporter}) async {
-    _client = new io.HttpClient();
+    _client = new HttpClient();
     _client.maxConnectionsPerHost = kMaxInFlight;
     _completer = new Completer<Null>();
     _outstanding = entries.toList();
@@ -246,14 +246,14 @@
   Future<Null> _scheduleWrite(DevFSEntry entry,
                               DevFSProgressReporter progressReporter) async {
     try {
-      io.HttpClientRequest request = await _client.putUrl(httpAddress);
-      request.headers.removeAll(io.HttpHeaders.ACCEPT_ENCODING);
+      HttpClientRequest request = await _client.putUrl(httpAddress);
+      request.headers.removeAll(HttpHeaders.ACCEPT_ENCODING);
       request.headers.add('dev_fs_name', fsName);
       request.headers.add('dev_fs_path_b64',
                           BASE64.encode(UTF8.encode(entry.devicePath)));
       Stream<List<int>> contents = entry.contentsAsCompressedStream();
       await request.addStream(contents);
-      io.HttpClientResponse response = await request.close();
+      HttpClientResponse response = await request.close();
       await response.drain();
     } catch (e, stackTrace) {
       printError('Error writing "${entry.devicePath}" to DevFS: $e\n$stackTrace');
diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart
index d6ad8ec..252df30 100644
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:archive/archive.dart';
 import 'dart:convert' show UTF8;
@@ -13,6 +12,7 @@
 import 'base/common.dart';
 import 'base/context.dart';
 import 'base/file_system.dart';
+import 'base/io.dart';
 import 'device.dart';
 import 'globals.dart';
 import 'ios/ios_workflow.dart';
@@ -27,7 +27,7 @@
 };
 
 String osName() {
-  String os = io.Platform.operatingSystem;
+  String os = Platform.operatingSystem;
   return _osNames.containsKey(os) ? _osNames[os] : os;
 }
 
@@ -124,7 +124,7 @@
       else
         printStatus('${result.leadingBox} ${validator.title}');
 
-      final String separator = io.Platform.isWindows ? ' ' : '•';
+      final String separator = Platform.isWindows ? ' ' : '•';
 
       for (ValidationMessage message in result.messages) {
         String text = message.message.replaceAll('\n', '\n      ');
@@ -182,7 +182,7 @@
     if (type == ValidationType.missing)
       return '[x]';
     else if (type == ValidationType.installed)
-      return io.Platform.isWindows ? '[+]' : '[✓]';
+      return Platform.isWindows ? '[+]' : '[✓]';
     else
       return '[-]';
   }
@@ -217,7 +217,7 @@
     messages.add(new ValidationMessage('Engine revision ${version.engineRevisionShort}'));
     messages.add(new ValidationMessage('Tools Dart version ${version.dartSdkVersion}'));
 
-    if (io.Platform.isWindows) {
+    if (Platform.isWindows) {
       valid = ValidationType.missing;
 
       messages.add(new ValidationMessage.error(
@@ -254,9 +254,9 @@
   };
 
   static Iterable<DoctorValidator> get installedValidators {
-    if (io.Platform.isLinux)
+    if (Platform.isLinux)
       return IntelliJValidatorOnLinux.installed;
-    if (io.Platform.isMacOS)
+    if (Platform.isMacOS)
       return IntelliJValidatorOnMac.installed;
     // TODO(danrubel): add support for Windows
     return <DoctorValidator>[];
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index 0017cbf..8ef01f2 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -4,10 +4,10 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 
 import '../application_package.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/os.dart';
 import '../base/process.dart';
 import '../base/process_manager.dart';
@@ -28,7 +28,7 @@
   IOSDevices() : super('IOSDevices');
 
   @override
-  bool get supportsPlatform => io.Platform.isMacOS;
+  bool get supportsPlatform => Platform.isMacOS;
 
   @override
   List<Device> pollingGetDevices() => IOSDevice.getAttachedDevices();
@@ -125,7 +125,7 @@
       try {
         command = runCheckedSync(<String>['which', command]).trim();
       } catch (e) {
-        if (io.Platform.isMacOS) {
+        if (Platform.isMacOS) {
           printError('$command not found. $macInstructions');
         } else {
           printError('Cannot control iOS devices or simulators. $command is not available on your platform.');
@@ -313,7 +313,7 @@
   }
 
   Future<bool> pushFile(ApplicationPackage app, String localFile, String targetFile) async {
-    if (io.Platform.isMacOS) {
+    if (Platform.isMacOS) {
       runSync(<String>[
         pusherPath,
         '-t',
@@ -392,7 +392,7 @@
   final IOSDevice device;
 
   StreamController<String> _linesController;
-  io.Process _process;
+  Process _process;
 
   @override
   Stream<String> get logLines => _linesController.stream;
@@ -401,7 +401,7 @@
   String get name => device.name;
 
   void _start() {
-    runCommand(<String>[device.loggerPath]).then((io.Process process) {
+    runCommand(<String>[device.loggerPath]).then((Process process) {
       _process = process;
       _process.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
       _process.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
@@ -445,7 +445,7 @@
     }
 
     // Usage: iproxy LOCAL_TCP_PORT DEVICE_TCP_PORT UDID
-    io.Process process = await runCommand(<String>[
+    Process process = await runCommand(<String>[
       device.iproxyPath,
       hostPort.toString(),
       devicePort.toString(),
@@ -471,7 +471,7 @@
 
     printTrace("Unforwarding port $forwardedPort");
 
-    io.Process process = forwardedPort.context;
+    Process process = forwardedPort.context;
 
     if (process != null) {
       processManager.killPid(process.pid);
diff --git a/packages/flutter_tools/lib/src/ios/ios_workflow.dart b/packages/flutter_tools/lib/src/ios/ios_workflow.dart
index e2f9096..cc89764 100644
--- a/packages/flutter_tools/lib/src/ios/ios_workflow.dart
+++ b/packages/flutter_tools/lib/src/ios/ios_workflow.dart
@@ -3,8 +3,8 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
+import '../base/io.dart';
 import '../base/os.dart';
 import '../base/process.dart';
 import '../doctor.dart';
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index cf1d317..191d7bd 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -4,13 +4,13 @@
 
 import 'dart:async';
 import 'dart:convert' show JSON;
-import 'dart:io' as io;
 
 import 'package:path/path.dart' as path;
 
 import '../application_package.dart';
 import '../base/context.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/process.dart';
 import '../base/process_manager.dart';
 import '../build_info.dart';
@@ -41,7 +41,7 @@
       } else {
         try {
           printTrace('xcrun clang');
-          io.ProcessResult result = processManager.runSync('/usr/bin/xcrun', <String>['clang']);
+          ProcessResult result = processManager.runSync('/usr/bin/xcrun', <String>['clang']);
 
           if (result.stdout != null && result.stdout.contains('license'))
             _eulaSigned = false;
@@ -220,7 +220,7 @@
 final String _xcodeRequirement = 'Xcode 7.0 or greater is required to develop for iOS.';
 
 bool _checkXcodeVersion() {
-  if (!io.Platform.isMacOS)
+  if (!Platform.isMacOS)
     return false;
   try {
     String version = runCheckedSync(<String>['xcodebuild', '-version']);
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index 597ca42..ce457a7 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -4,7 +4,6 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 import 'dart:math' as math;
 
 import 'package:path/path.dart' as path;
@@ -13,6 +12,7 @@
 import '../base/common.dart';
 import '../base/context.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/process.dart';
 import '../base/process_manager.dart';
 import '../build_info.dart';
@@ -31,7 +31,7 @@
   IOSSimulators() : super('IOSSimulators');
 
   @override
-  bool get supportsPlatform => io.Platform.isMacOS;
+  bool get supportsPlatform => Platform.isMacOS;
 
   @override
   List<Device> pollingGetDevices() => IOSSimulatorUtils.instance.getAttachedDevices();
@@ -192,7 +192,7 @@
 
     List<String> args = <String>['simctl', 'list', '--json', section.name];
     printTrace('$_xcrunPath ${args.join(' ')}');
-    io.ProcessResult results = processManager.runSync(_xcrunPath, args);
+    ProcessResult results = processManager.runSync(_xcrunPath, args);
     if (results.exitCode != 0) {
       printError('Error executing simctl: ${results.exitCode}\n${results.stderr}');
       return <String, Map<String, dynamic>>{};
@@ -359,7 +359,7 @@
 
   @override
   bool isSupported() {
-    if (!io.Platform.isMacOS) {
+    if (!Platform.isMacOS) {
       _supportMessage = "Not supported on a non Mac host";
       return false;
     }
@@ -531,7 +531,7 @@
 
   Future<bool> pushFile(
       ApplicationPackage app, String localFile, String targetFile) async {
-    if (io.Platform.isMacOS) {
+    if (Platform.isMacOS) {
       String simulatorHomeDirectory = _getSimulatorAppHomeDirectory(app);
       runCheckedSync(<String>['cp', localFile, path.join(simulatorHomeDirectory, targetFile)]);
       return true;
@@ -640,8 +640,8 @@
   StreamController<String> _linesController;
 
   // We log from two files: the device and the system log.
-  io.Process _deviceProcess;
-  io.Process _systemProcess;
+  Process _deviceProcess;
+  Process _systemProcess;
 
   @override
   Stream<String> get logLines => _linesController.stream;
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index d049556..3f3ff17 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:meta/meta.dart';
 import 'package:path/path.dart' as path;
 
 import 'application_package.dart';
 import 'base/file_system.dart';
+import 'base/io.dart';
 import 'base/logger.dart';
 import 'build_info.dart';
 import 'device.dart';
@@ -78,12 +78,12 @@
   }
 
   void registerSignalHandlers() {
-    io.ProcessSignal.SIGINT.watch().listen((io.ProcessSignal signal) async {
+    ProcessSignal.SIGINT.watch().listen((ProcessSignal signal) async {
       _resetTerminal();
       await cleanupAfterSignal();
       exit(0);
     });
-    io.ProcessSignal.SIGTERM.watch().listen((io.ProcessSignal signal) async {
+    ProcessSignal.SIGTERM.watch().listen((ProcessSignal signal) async {
       _resetTerminal();
       await cleanupAfterSignal();
       exit(0);
@@ -92,19 +92,19 @@
       return;
     if (!supportsRestart)
       return;
-    io.ProcessSignal.SIGUSR1.watch().listen(_handleSignal);
-    io.ProcessSignal.SIGUSR2.watch().listen(_handleSignal);
+    ProcessSignal.SIGUSR1.watch().listen(_handleSignal);
+    ProcessSignal.SIGUSR2.watch().listen(_handleSignal);
   }
 
   bool _processingSignal = false;
-  Future<Null> _handleSignal(io.ProcessSignal signal) async {
+  Future<Null> _handleSignal(ProcessSignal signal) async {
     if (_processingSignal) {
       printTrace('Ignoring signal: "$signal" because we are busy.');
       return;
     }
     _processingSignal = true;
 
-    final bool fullRestart = signal == io.ProcessSignal.SIGUSR2;
+    final bool fullRestart = signal == ProcessSignal.SIGUSR2;
 
     try {
       await restart(fullRestart: fullRestart);
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
index 4d2078e..e67848e 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io' as io;
 
 import 'package:args/args.dart';
 import 'package:args/command_runner.dart';
@@ -13,6 +12,7 @@
 import '../base/common.dart';
 import '../base/context.dart';
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/logger.dart';
 import '../base/process.dart';
 import '../base/process_manager.dart';
@@ -118,12 +118,12 @@
   }
 
   static String get _defaultFlutterRoot {
-    if (io.Platform.environment.containsKey(kFlutterRootEnvironmentVariableName))
-      return io.Platform.environment[kFlutterRootEnvironmentVariableName];
+    if (Platform.environment.containsKey(kFlutterRootEnvironmentVariableName))
+      return Platform.environment[kFlutterRootEnvironmentVariableName];
     try {
-      if (io.Platform.script.scheme == 'data')
+      if (Platform.script.scheme == 'data')
         return '../..'; // we're running as a test
-      String script = io.Platform.script.toFilePath();
+      String script = Platform.script.toFilePath();
       if (path.basename(script) == kSnapshotFileName)
         return path.dirname(path.dirname(path.dirname(script)));
       if (path.basename(script) == kFlutterToolsScriptFileName)
@@ -192,7 +192,7 @@
     // enginePath's initialiser uses it).
     Cache.flutterRoot = path.normalize(path.absolute(globalResults['flutter-root']));
 
-    if (io.Platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true')
+    if (Platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true')
       await Cache.lock();
 
     if (globalResults['suppress-analytics'])
@@ -232,7 +232,7 @@
   }
 
   String _findEnginePath(ArgResults globalResults) {
-    String engineSourcePath = globalResults['local-engine-src-path'] ?? io.Platform.environment[kFlutterEngineEnvironmentVariableName];
+    String engineSourcePath = globalResults['local-engine-src-path'] ?? Platform.environment[kFlutterEngineEnvironmentVariableName];
 
     if (engineSourcePath == null && globalResults['local-engine'] != null) {
       try {
diff --git a/packages/flutter_tools/lib/src/test/coverage_collector.dart b/packages/flutter_tools/lib/src/test/coverage_collector.dart
index bba97e2..d080ed8 100644
--- a/packages/flutter_tools/lib/src/test/coverage_collector.dart
+++ b/packages/flutter_tools/lib/src/test/coverage_collector.dart
@@ -3,11 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:coverage/coverage.dart';
 import 'package:path/path.dart' as path;
 
+import '../base/file_system.dart';
+import '../base/io.dart';
 import '../dart/package_map.dart';
 import '../globals.dart';
 
@@ -67,7 +68,7 @@
       return null;
     if (formatter == null) {
       Resolver resolver = new Resolver(packagesPath: PackageMap.globalPackagesPath);
-      String packagePath = Directory.current.path;
+      String packagePath = fs.currentDirectory.path;
       List<String> reportOn = <String>[path.join(packagePath, 'lib')];
       formatter = new LcovFormatter(resolver, reportOn: reportOn, basePath: packagePath);
     }
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index 67d6d37..207f799 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -4,7 +4,6 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io' as io;
 import 'dart:math' as math;
 
 import 'package:path/path.dart' as path;
@@ -15,13 +14,14 @@
 import 'package:test/src/runner/plugin/hack_register_platform.dart' as hack; // ignore: implementation_imports
 
 import '../base/file_system.dart';
+import '../base/io.dart';
 import '../base/process_manager.dart';
 import '../dart/package_map.dart';
 import '../globals.dart';
 import 'coverage_collector.dart';
 
 const Duration _kTestStartupTimeout = const Duration(seconds: 5);
-final io.InternetAddress _kHost = io.InternetAddress.LOOPBACK_IP_V4;
+final InternetAddress _kHost = InternetAddress.LOOPBACK_IP_V4;
 
 void installHook({ String shellPath }) {
   hack.registerPlatformPlugin(<TestPlatform>[TestPlatform.vm], () => new FlutterPlatform(shellPath: shellPath));
@@ -62,11 +62,11 @@
       controller.sink.done.then((_) { controllerSinkClosed = true; });
 
       // Prepare our WebSocket server to talk to the engine subproces.
-      io.HttpServer server = await io.HttpServer.bind(_kHost, 0);
+      HttpServer server = await HttpServer.bind(_kHost, 0);
       finalizers.add(() async { await server.close(force: true); });
-      Completer<io.WebSocket> webSocket = new Completer<io.WebSocket>();
-      server.listen((io.HttpRequest request) {
-        webSocket.complete(io.WebSocketTransformer.upgrade(request));
+      Completer<WebSocket> webSocket = new Completer<WebSocket>();
+      server.listen((HttpRequest request) {
+        webSocket.complete(WebSocketTransformer.upgrade(request));
       });
 
       // Prepare a temporary directory to store the Dart file that will talk to us.
@@ -91,7 +91,7 @@
       }
 
       // Start the engine subprocess.
-      io.Process process = await _startProcess(
+      Process process = await _startProcess(
         shellPath,
         listenerFile.path,
         packages: PackageMap.globalPackagesPath,
@@ -120,7 +120,7 @@
       _InitialResult initialResult = await Future.any(<Future<_InitialResult>>[
         process.exitCode.then<_InitialResult>((int exitCode) { return _InitialResult.crashed; }),
         new Future<_InitialResult>.delayed(_kTestStartupTimeout, () { return _InitialResult.timedOut; }),
-        webSocket.future.then<_InitialResult>((io.WebSocket webSocket) { return _InitialResult.connected; }),
+        webSocket.future.then<_InitialResult>((WebSocket webSocket) { return _InitialResult.connected; }),
       ]);
 
       switch (initialResult) {
@@ -138,7 +138,7 @@
           await controller.sink.done;
           break;
         case _InitialResult.connected:
-          io.WebSocket testSocket = await webSocket.future;
+          WebSocket testSocket = await webSocket.future;
 
           Completer<Null> harnessDone = new Completer<Null>();
           StreamSubscription<dynamic> harnessToTest = controller.stream.listen(
@@ -213,7 +213,7 @@
   }) {
     return '''
 import 'dart:convert';
-import 'dart:io';
+import 'dart:io'; // ignore: dart_io_import
 
 import 'package:stream_channel/stream_channel.dart';
 import 'package:test/src/runner/plugin/remote_platform_helpers.dart';
@@ -257,7 +257,7 @@
   }
 
 
-  Future<io.Process> _startProcess(String executable, String testPath, { String packages, int observatoryPort }) {
+  Future<Process> _startProcess(String executable, String testPath, { String packages, int observatoryPort }) {
     assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable.
     List<String> arguments = <String>[];
     if (observatoryPort != null) {
@@ -280,7 +280,7 @@
     return processManager.start(executable, arguments, environment: environment);
   }
 
-  void _pipeStandardStreamsToConsole(io.Process process) {
+  void _pipeStandardStreamsToConsole(Process process) {
     for (Stream<List<int>> stream in
         <Stream<List<int>>>[process.stderr, process.stdout]) {
       stream.transform(UTF8.decoder)
diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart
index 953d41e..579290d 100644
--- a/packages/flutter_tools/lib/src/version.dart
+++ b/packages/flutter_tools/lib/src/version.dart
@@ -2,8 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io';
-
+import 'base/io.dart';
 import 'base/process.dart';
 import 'base/process_manager.dart';
 import 'cache.dart';
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index b44405f..41bc426 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -4,7 +4,6 @@
 
 import 'dart:async';
 import 'dart:convert' show BASE64;
-import 'dart:io';
 
 import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
 import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
@@ -12,6 +11,7 @@
 import 'package:stream_channel/stream_channel.dart';
 import 'package:web_socket_channel/io.dart';
 
+import 'base/io.dart';
 import 'globals.dart';
 
 /// The default VM service request timeout.