Update flutter_tools to use package:file throughout (#7385)

This removes direct file access from within flutter_tools
in favor of using `package:file` via a `FileSystem` that's
accessed via the `ApplicationContext`.

This lays the groundwork for us to be able to easily swap
out the underlying file system when running Flutter tools,
which will be used to provide a record/replay file system,
analogous to what we have for process invocations.
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index 3af6e17..cda0f21 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -4,12 +4,13 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+import 'dart:io' as io;
 
 import '../android/android_sdk.dart';
 import '../application_package.dart';
-import '../base/os.dart';
+import '../base/file_system.dart';
 import '../base/logger.dart';
+import '../base/os.dart';
 import '../base/process.dart';
 import '../base/process_manager.dart';
 import '../build_info.dart';
@@ -60,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.
-        ProcessResult result = processManager.runSync(
+        io.ProcessResult result = processManager.runSync(
           propCommand.first,
           propCommand.sublist(1),
           stdoutEncoding: LATIN1
@@ -201,7 +202,7 @@
 
   String _getSourceSha1(ApplicationPackage app) {
     AndroidApk apk = app;
-    File shaFile = new File('${apk.apkPath}.sha1');
+    File shaFile = fs.file('${apk.apkPath}.sha1');
     return shaFile.existsSync() ? shaFile.readAsStringSync() : '';
   }
 
@@ -222,7 +223,7 @@
   @override
   bool installApp(ApplicationPackage app) {
     AndroidApk apk = app;
-    if (!FileSystemEntity.isFileSync(apk.apkPath)) {
+    if (!fs.isFileSync(apk.apkPath)) {
       printError('"${apk.apkPath}" does not exist.');
       return false;
     }
@@ -558,7 +559,7 @@
   final AndroidDevice device;
 
   StreamController<String> _linesController;
-  Process _process;
+  io.Process _process;
 
   @override
   Stream<String> get logLines => _linesController.stream;
@@ -584,7 +585,7 @@
         _timeOrigin = _adbTimestampToDateTime(lastTimestamp);
     else
         _timeOrigin = null;
-    runCommand(device.adbCommandForDevice(args)).then((Process process) {
+    runCommand(device.adbCommandForDevice(args)).then((io.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 caf9686..832d7fe 100644
--- a/packages/flutter_tools/lib/src/android/android_sdk.dart
+++ b/packages/flutter_tools/lib/src/android/android_sdk.dart
@@ -2,13 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io';
+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/os.dart';
 import '../globals.dart';
 
@@ -64,12 +65,12 @@
 
   static AndroidSdk locateAndroidSdk() {
     String androidHomeDir;
-    if (Platform.environment.containsKey(kAndroidHome)) {
-      androidHomeDir = Platform.environment[kAndroidHome];
-    } else if (Platform.isLinux) {
+    if (io.Platform.environment.containsKey(kAndroidHome)) {
+      androidHomeDir = io.Platform.environment[kAndroidHome];
+    } else if (io.Platform.isLinux) {
       if (homeDirPath != null)
         androidHomeDir = '$homeDirPath/Android/Sdk';
-    } else if (Platform.isMacOS) {
+    } else if (io.Platform.isMacOS) {
       if (homeDirPath != null)
         androidHomeDir = '$homeDirPath/Library/Android/sdk';
     }
@@ -84,7 +85,7 @@
     File aaptBin = os.which('aapt'); // in build-tools/$version/aapt
     if (aaptBin != null) {
       // Make sure we're using the aapt from the SDK.
-      aaptBin = new File(aaptBin.resolveSymbolicLinksSync());
+      aaptBin = fs.file(aaptBin.resolveSymbolicLinksSync());
       String dir = aaptBin.parent.parent.parent.path;
       if (validSdkDirectory(dir))
         return new AndroidSdk(dir);
@@ -93,7 +94,7 @@
     File adbBin = os.which('adb'); // in platform-tools/adb
     if (adbBin != null) {
       // Make sure we're using the adb from the SDK.
-      adbBin = new File(adbBin.resolveSymbolicLinksSync());
+      adbBin = fs.file(adbBin.resolveSymbolicLinksSync());
       String dir = adbBin.parent.parent.path;
       if (validSdkDirectory(dir))
         return new AndroidSdk(dir);
@@ -105,7 +106,7 @@
   }
 
   static bool validSdkDirectory(String dir) {
-    return FileSystemEntity.isDirectorySync(path.join(dir, 'platform-tools'));
+    return fs.isDirectorySync(path.join(dir, 'platform-tools'));
   }
 
   List<AndroidSdkVersion> get sdkVersions => _sdkVersions;
@@ -117,7 +118,7 @@
   /// Validate the Android SDK. This returns an empty list if there are no
   /// issues; otherwise, it returns a list of issues found.
   List<String> validateSdkWellFormed() {
-    if (!FileSystemEntity.isFileSync(adbPath))
+    if (!fs.isFileSync(adbPath))
       return <String>['Android SDK file not found: $adbPath.'];
 
     if (sdkVersions.isEmpty || latestVersion == null)
@@ -133,7 +134,7 @@
   void _init() {
     List<String> platforms = <String>[]; // android-22, ...
 
-    Directory platformsDir = new Directory(path.join(directory, 'platforms'));
+    Directory platformsDir = fs.directory(path.join(directory, 'platforms'));
     if (platformsDir.existsSync()) {
       platforms = platformsDir
         .listSync()
@@ -144,7 +145,7 @@
 
     List<Version> buildTools = <Version>[]; // 19.1.0, 22.0.1, ...
 
-    Directory buildToolsDir = new Directory(path.join(directory, 'build-tools'));
+    Directory buildToolsDir = fs.directory(path.join(directory, 'build-tools'));
     if (buildToolsDir.existsSync()) {
       buildTools = buildToolsDir
         .listSync()
@@ -253,7 +254,7 @@
   String toString() => '[${sdk.directory}, SDK version $sdkLevel, build-tools $buildToolsVersionName]';
 
   String _exists(String path) {
-    if (!FileSystemEntity.isFileSync(path))
+    if (!fs.isFileSync(path))
       return 'Android SDK file not found: $path.';
     return null;
   }
diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart
index 0c873a6..3c29be0 100644
--- a/packages/flutter_tools/lib/src/android/gradle.dart
+++ b/packages/flutter_tools/lib/src/android/gradle.dart
@@ -3,11 +3,11 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:path/path.dart' as path;
 
 import '../base/common.dart';
+import '../base/file_system.dart';
 import '../base/logger.dart';
 import '../base/os.dart';
 import '../base/process.dart';
@@ -21,13 +21,13 @@
 const String gradleAppOut = 'android/app/build/outputs/apk/app-debug.apk';
 
 bool isProjectUsingGradle() {
-  return FileSystemEntity.isFileSync('android/build.gradle');
+  return fs.isFileSync('android/build.gradle');
 }
 
 String locateSystemGradle({ bool ensureExecutable: true }) {
   String gradle = _locateSystemGradle();
   if (ensureExecutable && gradle != null) {
-    File file = new File(gradle);
+    File file = fs.file(gradle);
     if (file.existsSync())
       os.makeExecutable(file);
   }
@@ -38,7 +38,7 @@
   // See if the user has explicitly configured gradle-dir.
   String gradleDir = config.getValue('gradle-dir');
   if (gradleDir != null) {
-    if (FileSystemEntity.isFileSync(gradleDir))
+    if (fs.isFileSync(gradleDir))
       return gradleDir;
     return path.join(gradleDir, 'bin', 'gradle');
   }
@@ -48,7 +48,7 @@
 
   if (studioPath == null && os.isMacOS) {
     final String kDefaultMacPath = '/Applications/Android Studio.app';
-    if (FileSystemEntity.isDirectorySync(kDefaultMacPath))
+    if (fs.isDirectorySync(kDefaultMacPath))
       studioPath = kDefaultMacPath;
   }
 
@@ -57,13 +57,13 @@
     if (os.isMacOS && !studioPath.endsWith('Contents'))
       studioPath = path.join(studioPath, 'Contents');
 
-    Directory dir = new Directory(path.join(studioPath, 'gradle'));
+    Directory dir = fs.directory(path.join(studioPath, 'gradle'));
     if (dir.existsSync()) {
       // We find the first valid gradle directory.
       for (FileSystemEntity entity in dir.listSync()) {
         if (entity is Directory && path.basename(entity.path).startsWith('gradle-')) {
           String executable = path.join(entity.path, 'bin', 'gradle');
-          if (FileSystemEntity.isFileSync(executable))
+          if (fs.isFileSync(executable))
             return executable;
         }
       }
@@ -82,9 +82,9 @@
 String locateProjectGradlew({ bool ensureExecutable: true }) {
   final String path = 'android/gradlew';
 
-  if (FileSystemEntity.isFileSync(path)) {
+  if (fs.isFileSync(path)) {
     if (ensureExecutable)
-      os.makeExecutable(new File(path));
+      os.makeExecutable(fs.file(path));
     return path;
   } else {
     return null;
@@ -93,7 +93,7 @@
 
 Future<Null> buildGradleProject(BuildMode buildMode) async {
   // Create android/local.properties.
-  File localProperties = new File('android/local.properties');
+  File localProperties = fs.file('android/local.properties');
   if (!localProperties.existsSync()) {
     localProperties.writeAsStringSync(
       'sdk.dir=${androidSdk.directory}\n'
@@ -120,7 +120,7 @@
     }
 
     // Stamp the android/app/build.gradle file with the current android sdk and build tools version.
-    File appGradleFile = new File('android/app/build.gradle');
+    File appGradleFile = fs.file('android/app/build.gradle');
     if (appGradleFile.existsSync()) {
       _GradleFile gradleFile = new _GradleFile.parse(appGradleFile);
       AndroidSdkVersion sdkVersion = androidSdk.latestVersion;
@@ -152,7 +152,7 @@
   // Run 'gradlew build'.
   Status status = logger.startProgress('Running \'gradlew build\'...');
   int exitcode = await runCommandAndStreamOutput(
-    <String>[new File('android/gradlew').absolute.path, 'build'],
+    <String>[fs.file('android/gradlew').absolute.path, 'build'],
     workingDirectory: 'android',
     allowReentrantFlutter: true
   );
@@ -161,7 +161,7 @@
   if (exitcode != 0)
     throwToolExit('Gradlew failed: $exitcode', exitCode: exitcode);
 
-  File apkFile = new File(gradleAppOut);
+  File apkFile = fs.file(gradleAppOut);
   printStatus('Built $gradleAppOut (${getSizeAsMB(apkFile.lengthSync())}).');
 }
 
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index 0a73e28..45fef2c 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -2,13 +2,12 @@
 // 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 'package:xml/xml.dart' as xml;
 
 import 'android/android_sdk.dart';
 import 'android/gradle.dart';
+import 'base/file_system.dart';
 import 'base/os.dart' show os;
 import 'base/process.dart';
 import 'build_info.dart';
@@ -89,10 +88,10 @@
       apkPath = path.join(getAndroidBuildDirectory(), 'app.apk');
     }
 
-    if (!FileSystemEntity.isFileSync(manifestPath))
+    if (!fs.isFileSync(manifestPath))
       return null;
 
-    String manifestString = new File(manifestPath).readAsStringSync();
+    String manifestString = fs.file(manifestPath).readAsStringSync();
     xml.XmlDocument document = xml.parse(manifestString);
 
     Iterable<xml.XmlElement> manifests = document.findElements('manifest');
@@ -135,10 +134,10 @@
   factory IOSApp.fromIpa(String applicationBinary) {
     Directory bundleDir;
     try {
-      Directory tempDir = Directory.systemTemp.createTempSync('flutter_app_');
+      Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_app_');
       addShutdownHook(() async => await tempDir.delete(recursive: true));
-      os.unzip(new File(applicationBinary), tempDir);
-      Directory payloadDir = new Directory(path.join(tempDir.path, 'Payload'));
+      os.unzip(fs.file(applicationBinary), tempDir);
+      Directory payloadDir = fs.directory(path.join(tempDir.path, 'Payload'));
       bundleDir = payloadDir.listSync().singleWhere(_isBundleDirectory);
     } on StateError catch (e, stackTrace) {
       printError('Invalid prebuilt iOS binary: ${e.toString()}', stackTrace);
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index 36a8cf8..3a5729f 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -4,12 +4,13 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+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 'build_info.dart';
 import 'cache.dart';
 import 'dart/package_map.dart';
@@ -74,7 +75,7 @@
       final String assetPath = path.join(projectRoot, asset);
       final String archivePath = asset;
       entries.add(
-          new AssetBundleEntry.fromFile(archivePath, new File(assetPath)));
+          new AssetBundleEntry.fromFile(archivePath, fs.file(assetPath)));
     }
   }
 
@@ -84,7 +85,7 @@
     if (_lastBuildTimestamp == null)
       return true;
 
-    FileStat stat = new File(manifestPath).statSync();
+    FileStat stat = fs.file(manifestPath).statSync();
     if (stat.type == FileSystemEntityType.NOT_FOUND)
       return true;
 
@@ -206,7 +207,7 @@
   final String source;
 
   File get assetFile {
-    return new File(source != null ? '$base/$source' : '$base/$relativePath');
+    return fs.file(source != null ? '$base/$source' : '$base/$relativePath');
   }
 
   bool get assetFileExists => assetFile.existsSync();
@@ -228,7 +229,7 @@
   String fontsPath = path.join(path.absolute(Cache.flutterRoot),
       'packages', 'flutter_tools', 'schema', 'material_fonts.yaml');
 
-  return loadYaml(new File(fontsPath).readAsStringSync());
+  return loadYaml(fs.file(fontsPath).readAsStringSync());
 }
 
 final Map<String, dynamic> _materialFontsManifest = _readMaterialFontsManifest();
@@ -280,7 +281,7 @@
   for (String packageName in packageMap.map.keys) {
     final Uri package = packageMap.map[packageName];
     if (package != null && package.scheme == 'file') {
-      final File file = new File.fromUri(package.resolve('../LICENSE'));
+      final File file = fs.file(package.resolve('../LICENSE'));
       if (file.existsSync()) {
         final List<String> rawLicenses =
             (await file.readAsString()).split(_licenseSeparator);
@@ -377,7 +378,7 @@
     return result;
 
   excludeDirs = excludeDirs.map(
-    (String exclude) => path.absolute(exclude) + Platform.pathSeparator).toList();
+    (String exclude) => path.absolute(exclude) + io.Platform.pathSeparator).toList();
 
   if (manifestDescriptor.containsKey('assets')) {
     for (String asset in manifestDescriptor['assets']) {
@@ -394,12 +395,12 @@
       // Find asset variants
       String assetPath = baseAsset.assetFile.path;
       String assetFilename = path.basename(assetPath);
-      Directory assetDir = new Directory(path.dirname(assetPath));
+      Directory assetDir = fs.directory(path.dirname(assetPath));
 
       List<FileSystemEntity> files = assetDir.listSync(recursive: true);
 
       for (FileSystemEntity entity in files) {
-        if (!FileSystemEntity.isFileSync(entity.path))
+        if (!fs.isFileSync(entity.path))
           continue;
 
         // Exclude any files in the given directories.
@@ -446,7 +447,7 @@
   String assetBase,
   String asset
 ) {
-  if (asset.startsWith('packages/') && !FileSystemEntity.isFileSync(path.join(assetBase, asset))) {
+  if (asset.startsWith('packages/') && !fs.isFileSync(path.join(assetBase, asset))) {
     // Convert packages/flutter_gallery_assets/clouds-0.png to clouds-0.png.
     String packageKey = asset.substring(9);
     String relativeAsset = asset;
@@ -459,7 +460,7 @@
 
     Uri uri = packageMap.map[packageKey];
     if (uri != null && uri.scheme == 'file') {
-      File file = new File.fromUri(uri);
+      File file = fs.file(uri);
       return new _Asset(base: file.path, assetEntry: asset, relativePath: relativeAsset);
     }
   }
@@ -468,9 +469,9 @@
 }
 
 dynamic _loadFlutterYamlManifest(String manifestPath) {
-  if (manifestPath == null || !FileSystemEntity.isFileSync(manifestPath))
+  if (manifestPath == null || !fs.isFileSync(manifestPath))
     return null;
-  String manifestDescriptor = new File(manifestPath).readAsStringSync();
+  String manifestDescriptor = fs.file(manifestPath).readAsStringSync();
   return loadYaml(manifestDescriptor);
 }
 
diff --git a/packages/flutter_tools/lib/src/base/config.dart b/packages/flutter_tools/lib/src/base/config.dart
index 6a53013..1bae133 100644
--- a/packages/flutter_tools/lib/src/base/config.dart
+++ b/packages/flutter_tools/lib/src/base/config.dart
@@ -3,15 +3,16 @@
 // found in the LICENSE file.
 
 import 'dart:convert';
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:path/path.dart' as path;
 
 import 'context.dart';
+import 'file_system.dart';
 
 class Config {
   Config([File configFile]) {
-    _configFile = configFile ?? new File(path.join(_userHomeDir(), '.flutter_settings'));
+    _configFile = configFile ?? fs.file(path.join(_userHomeDir(), '.flutter_settings'));
     if (_configFile.existsSync())
       _values = JSON.decode(_configFile.readAsStringSync());
   }
@@ -45,7 +46,7 @@
 }
 
 String _userHomeDir() {
-  String envKey = Platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
-  String value = Platform.environment[envKey];
+  String envKey = io.Platform.operatingSystem == 'windows' ? 'APPDATA' : 'HOME';
+  String value = io.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 ded0080..b3d9ce9 100644
--- a/packages/flutter_tools/lib/src/base/file_system.dart
+++ b/packages/flutter_tools/lib/src/base/file_system.dart
@@ -2,50 +2,57 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-import 'dart:io' as dart_io;
+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';
+
 export 'package:file/file.dart';
 export 'package:file/local.dart';
 
+const FileSystem _kLocalFs = const LocalFileSystem();
+
 /// Currently active implementation of the file system.
 ///
 /// By default it uses local disk-based implementation. Override this in tests
 /// with [MemoryFileSystem].
-FileSystem fs = new LocalFileSystem();
+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]) {
-  dart_io.exit(exitCode);
+  io.exit(exitCode);
 };
 
+ExitFunction _exitFunction = _defaultExitFunction;
+
 /// Exits the process.
-ExitFunction exit = _defaultExitFunction;
+///
+/// During tests, this may be set to a testing-friendly value by calling
+/// [setExitFunctionForTests] (and then restored with [restoreExitFunction]).
+ExitFunction get exit => _exitFunction;
 
-/// Restores [fs] to the default local disk-based implementation.
-void restoreFileSystem() {
-  fs = new LocalFileSystem();
-  exit = _defaultExitFunction;
-}
-
-/// Uses in-memory replacments for `dart:io` functionality. Useful in tests.
-void useInMemoryFileSystem({ String cwd: '/', ExitFunction exitFunction }) {
-  fs = new MemoryFileSystem();
-  if (!fs.directory(cwd).existsSync()) {
-    fs.directory(cwd).createSync(recursive: true);
-  }
-  fs.currentDirectory = cwd;
-  exit = exitFunction ?? ([int exitCode]) {
+/// 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);
@@ -57,20 +64,20 @@
 
 /// Recursively copies a folder from `srcPath` to `destPath`
 void copyFolderSync(String srcPath, String destPath) {
-  dart_io.Directory srcDir = new dart_io.Directory(srcPath);
+  Directory srcDir = fs.directory(srcPath);
   if (!srcDir.existsSync())
     throw new Exception('Source directory "${srcDir.path}" does not exist, nothing to copy');
 
-  dart_io.Directory destDir = new dart_io.Directory(destPath);
+  Directory destDir = fs.directory(destPath);
   if (!destDir.existsSync())
     destDir.createSync(recursive: true);
 
-  srcDir.listSync().forEach((dart_io.FileSystemEntity entity) {
+  srcDir.listSync().forEach((FileSystemEntity entity) {
     String newPath = path.join(destDir.path, path.basename(entity.path));
-    if (entity is dart_io.File) {
-      dart_io.File newFile = new dart_io.File(newPath);
+    if (entity is File) {
+      File newFile = fs.file(newPath);
       newFile.writeAsBytesSync(entity.readAsBytesSync());
-    } else if (entity is dart_io.Directory) {
+    } else if (entity is Directory) {
       copyFolderSync(entity.path, newPath);
     } else {
       throw new Exception('${entity.path} is neither File nor Directory');
diff --git a/packages/flutter_tools/lib/src/base/os.dart b/packages/flutter_tools/lib/src/base/os.dart
index 01c46d3..96ba3ec 100644
--- a/packages/flutter_tools/lib/src/base/os.dart
+++ b/packages/flutter_tools/lib/src/base/os.dart
@@ -3,12 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+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 'process.dart';
 import 'process_manager.dart';
 
@@ -17,7 +18,7 @@
 
 abstract class OperatingSystemUtils {
   factory OperatingSystemUtils() {
-    if (Platform.isWindows) {
+    if (io.Platform.isWindows) {
       return new _WindowsUtils();
     } else {
       return new _PosixUtils();
@@ -26,14 +27,14 @@
 
   OperatingSystemUtils._private();
 
-  String get operatingSystem => Platform.operatingSystem;
+  String get operatingSystem => io.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.
-  ProcessResult makeExecutable(File file);
+  io.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.
@@ -49,7 +50,7 @@
   _PosixUtils() : super._private();
 
   @override
-  ProcessResult makeExecutable(File file) {
+  io.ProcessResult makeExecutable(File file) {
     return processManager.runSync('chmod', <String>['a+x', file.path]);
   }
 
@@ -57,11 +58,11 @@
   /// to locate the binary.
   @override
   File which(String execName) {
-    ProcessResult result = processManager.runSync('which', <String>[execName]);
+    io.ProcessResult result = processManager.runSync('which', <String>[execName]);
     if (result.exitCode != 0)
       return null;
     String path = result.stdout.trim().split('\n').first.trim();
-    return new File(path);
+    return fs.file(path);
   }
 
   // unzip -o -q zipfile -d dest
@@ -73,7 +74,7 @@
   @override
   File makePipe(String path) {
     runSync(<String>['mkfifo', path]);
-    return new File(path);
+    return fs.file(path);
   }
 }
 
@@ -82,16 +83,16 @@
 
   // This is a no-op.
   @override
-  ProcessResult makeExecutable(File file) {
-    return new ProcessResult(0, 0, null, null);
+  io.ProcessResult makeExecutable(File file) {
+    return new io.ProcessResult(0, 0, null, null);
   }
 
   @override
   File which(String execName) {
-    ProcessResult result = processManager.runSync('where', <String>[execName]);
+    io.ProcessResult result = processManager.runSync('where', <String>[execName]);
     if (result.exitCode != 0)
       return null;
-    return new File(result.stdout.trim().split('\n').first.trim());
+    return fs.file(result.stdout.trim().split('\n').first.trim());
   }
 
   @override
@@ -103,7 +104,7 @@
       if (!archiveFile.isFile || archiveFile.name.endsWith('/'))
         continue;
 
-      File destFile = new File(path.join(targetDirectory.path, archiveFile.name));
+      File destFile = fs.file(path.join(targetDirectory.path, archiveFile.name));
       if (!destFile.parent.existsSync())
         destFile.parent.createSync(recursive: true);
       destFile.writeAsBytesSync(archiveFile.content);
@@ -117,7 +118,7 @@
 }
 
 Future<int> findAvailablePort() async {
-  ServerSocket socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0);
+  io.ServerSocket socket = await io.ServerSocket.bind(io.InternetAddress.LOOPBACK_IP_V4, 0);
   int port = socket.port;
   await socket.close();
   return port;
@@ -142,7 +143,7 @@
 
 Future<bool> _isPortAvailable(int port) async {
   try {
-    ServerSocket socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, port);
+    io.ServerSocket socket = await io.ServerSocket.bind(io.InternetAddress.LOOPBACK_IP_V4, port);
     await socket.close();
     return true;
   } catch (error) {
@@ -156,11 +157,11 @@
 /// or if the project root is the flutter repository root.
 String findProjectRoot([String directory]) {
   const String kProjectRootSentinel = 'pubspec.yaml';
-  directory ??= Directory.current.path;
+  directory ??= fs.currentDirectory.path;
   while (true) {
-    if (FileSystemEntity.isFileSync(path.join(directory, kProjectRootSentinel)))
+    if (fs.isFileSync(path.join(directory, kProjectRootSentinel)))
       return directory;
-    String parent = FileSystemEntity.parentOf(directory);
+    String parent = path.dirname(directory);
     if (directory == parent) return null;
     directory = parent;
   }
diff --git a/packages/flutter_tools/lib/src/base/process_manager.dart b/packages/flutter_tools/lib/src/base/process_manager.dart
index d3b9cde..1641d67 100644
--- a/packages/flutter_tools/lib/src/base/process_manager.dart
+++ b/packages/flutter_tools/lib/src/base/process_manager.dart
@@ -4,13 +4,14 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+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 'os.dart';
 import 'process.dart';
 
@@ -31,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<Process> start(
+  Future<io.Process> start(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    ProcessStartMode mode: ProcessStartMode.NORMAL,
+    io.ProcessStartMode mode: io.ProcessStartMode.NORMAL,
   }) {
-    return Process.start(
+    return io.Process.start(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -47,15 +48,15 @@
     );
   }
 
-  Future<ProcessResult> run(
+  Future<io.ProcessResult> run(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: SYSTEM_ENCODING,
-    Encoding stderrEncoding: SYSTEM_ENCODING,
+    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
+    Encoding stderrEncoding: io.SYSTEM_ENCODING,
   }) {
-    return Process.run(
+    return io.Process.run(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -65,15 +66,15 @@
     );
   }
 
-  ProcessResult runSync(
+  io.ProcessResult runSync(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: SYSTEM_ENCODING,
-    Encoding stderrEncoding: SYSTEM_ENCODING,
+    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
+    Encoding stderrEncoding: io.SYSTEM_ENCODING,
   }) {
-    return Process.runSync(
+    return io.Process.runSync(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -83,8 +84,8 @@
     );
   }
 
-  bool killPid(int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]) {
-    return Process.killPid(pid, signal);
+  bool killPid(int pid, [io.ProcessSignal signal = io.ProcessSignal.SIGTERM]) {
+    return io.Process.killPid(pid, signal);
   }
 }
 
@@ -101,7 +102,7 @@
 
   final String _recordTo;
   final ProcessManager _delegate = new ProcessManager();
-  final Directory _tmpDir = Directory.systemTemp.createTempSync('flutter_tools_');
+  final Directory _tmpDir = fs.systemTempDirectory.createTempSync('flutter_tools_');
   final List<Map<String, dynamic>> _manifest = <Map<String, dynamic>>[];
   final Map<int, Future<int>> _runningProcesses = <int, Future<int>>{};
 
@@ -121,14 +122,14 @@
   }
 
   @override
-  Future<Process> start(
+  Future<io.Process> start(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    ProcessStartMode mode: ProcessStartMode.NORMAL,
+    io.ProcessStartMode mode: io.ProcessStartMode.NORMAL,
   }) async {
-    Process process = await _delegate.start(
+    io.Process process = await _delegate.start(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -163,15 +164,15 @@
   }
 
   @override
-  Future<ProcessResult> run(
+  Future<io.ProcessResult> run(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: SYSTEM_ENCODING,
-    Encoding stderrEncoding: SYSTEM_ENCODING,
+    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
+    Encoding stderrEncoding: io.SYSTEM_ENCODING,
   }) async {
-    ProcessResult result = await _delegate.run(
+    io.ProcessResult result = await _delegate.run(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -201,7 +202,7 @@
 
   Future<Null> _recordData(dynamic data, Encoding encoding, String basename) async {
     String path = '${_tmpDir.path}/$basename';
-    File file = await new File(path).create();
+    File file = await fs.file(path).create();
     RandomAccessFile recording = await file.open(mode: FileMode.WRITE);
     try {
       if (encoding == null)
@@ -215,15 +216,15 @@
   }
 
   @override
-  ProcessResult runSync(
+  io.ProcessResult runSync(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: SYSTEM_ENCODING,
-    Encoding stderrEncoding: SYSTEM_ENCODING,
+    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
+    Encoding stderrEncoding: io.SYSTEM_ENCODING,
   }) {
-    ProcessResult result = _delegate.runSync(
+    io.ProcessResult result = _delegate.runSync(
       executable,
       arguments,
       workingDirectory: workingDirectory,
@@ -253,7 +254,7 @@
 
   void _recordDataSync(dynamic data, Encoding encoding, String basename) {
     String path = '${_tmpDir.path}/$basename';
-    File file = new File(path)..createSync();
+    File file = fs.file(path)..createSync();
     RandomAccessFile recording = file.openSync(mode: FileMode.WRITE);
     try {
       if (encoding == null)
@@ -267,7 +268,7 @@
   }
 
   @override
-  bool killPid(int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]) {
+  bool killPid(int pid, [io.ProcessSignal signal = io.ProcessSignal.SIGTERM]) {
     return _delegate.killPid(pid, signal);
   }
 
@@ -280,7 +281,7 @@
     List<String> arguments,
     String workingDirectory,
     Map<String, String> environment,
-    ProcessStartMode mode,
+    io.ProcessStartMode mode,
     Encoding stdoutEncoding,
     Encoding stderrEncoding,
     int exitCode,
@@ -331,7 +332,7 @@
     await _waitForRunningProcessesToExitWithTimeout(
       onTimeout: (int pid, Map<String, dynamic> manifestEntry) {
         manifestEntry['daemon'] = true;
-        Process.killPid(pid);
+        io.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.
@@ -358,7 +359,7 @@
   Future<Null> _writeManifestToDisk() async {
     JsonEncoder encoder = new JsonEncoder.withIndent('  ');
     String encodedManifest = encoder.convert(_manifest);
-    File manifestFile = await new File('${_tmpDir.path}/$_kManifestName').create();
+    File manifestFile = await fs.file('${_tmpDir.path}/$_kManifestName').create();
     await manifestFile.writeAsString(encodedManifest, flush: true);
   }
 
@@ -373,18 +374,18 @@
   /// in the [new RecordingProcessManager] constructor.
   Future<File> _createZipFile() async {
     File zipFile;
-    String recordTo = _recordTo ?? Directory.current.path;
-    if (FileSystemEntity.typeSync(recordTo) == FileSystemEntityType.DIRECTORY) {
-      zipFile = new File('$recordTo/$kDefaultRecordTo');
+    String recordTo = _recordTo ?? fs.currentDirectory.path;
+    if (fs.isDirectorySync(recordTo)) {
+      zipFile = fs.file('$recordTo/$kDefaultRecordTo');
     } else {
-      zipFile = new File(recordTo);
-      await new Directory(path.dirname(zipFile.path)).create(recursive: true);
+      zipFile = fs.file(recordTo);
+      await fs.directory(path.dirname(zipFile.path)).create(recursive: true);
     }
 
     // Resolve collisions.
     String basename = path.basename(zipFile.path);
     for (int i = 1; zipFile.existsSync(); i++) {
-      assert(FileSystemEntity.isFileSync(zipFile.path));
+      assert(fs.isFileSync(zipFile.path));
       String disambiguator = new NumberFormat('00').format(i);
       String newBasename = basename;
       if (basename.contains('.')) {
@@ -394,7 +395,7 @@
       } else {
         newBasename += '-$disambiguator';
       }
-      zipFile = new File(path.join(path.dirname(zipFile.path), newBasename));
+      zipFile = fs.file(path.join(path.dirname(zipFile.path), newBasename));
     }
 
     return await zipFile.create();
@@ -404,7 +405,7 @@
   Future<List<int>> _getRecordingZipBytes() async {
     Archive archive = new Archive();
     Stream<FileSystemEntity> files = _tmpDir.list(recursive: true)
-        .where((FileSystemEntity entity) => FileSystemEntity.isFileSync(entity.path));
+        .where((FileSystemEntity entity) => fs.isFileSync(entity.path));
     List<Future<dynamic>> addAllFilesToArchive = <Future<dynamic>>[];
     await files.forEach((FileSystemEntity entity) {
       File file = entity;
@@ -437,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 Process {
-  final Process delegate;
+class _RecordingProcess implements io.Process {
+  final io.Process delegate;
   final String basename;
   final RecordingProcessManager manager;
 
@@ -464,7 +465,7 @@
     String suffix,
   ) async {
     String path = '${manager._tmpDir.path}/$basename.$suffix';
-    File file = await new File(path).create();
+    File file = await fs.file(path).create();
     RandomAccessFile recording = await file.open(mode: FileMode.WRITE);
     stream.listen(
       (List<int> data) {
@@ -506,7 +507,7 @@
   }
 
   @override
-  IOSink get stdin {
+  io.IOSink get stdin {
     // We don't currently support recording `stdin`.
     return delegate.stdin;
   }
@@ -515,7 +516,7 @@
   int get pid => delegate.pid;
 
   @override
-  bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]) => delegate.kill(signal);
+  bool kill([io.ProcessSignal signal = io.ProcessSignal.SIGTERM]) => delegate.kill(signal);
 }
 
 /// A [ProcessManager] implementation that mocks out all process invocations
@@ -572,22 +573,22 @@
   /// directory, an [ArgumentError] will be thrown.
   static Future<ReplayProcessManager> create(String location) async {
     Directory dir;
-    switch (FileSystemEntity.typeSync(location)) {
+    switch (fs.typeSync(location)) {
       case FileSystemEntityType.FILE:
-        dir = await Directory.systemTemp.createTemp('flutter_tools_');
-        os.unzip(new File(location), dir);
+        dir = await fs.systemTempDirectory.createTemp('flutter_tools_');
+        os.unzip(fs.file(location), dir);
         addShutdownHook(() async {
           await dir.delete(recursive: true);
         });
         break;
       case FileSystemEntityType.DIRECTORY:
-        dir = new Directory(location);
+        dir = fs.directory(location);
         break;
       case FileSystemEntityType.NOT_FOUND:
         throw new ArgumentError.value(location, 'location', 'Does not exist');
     }
 
-    File manifestFile = new File(path.join(dir.path, _kManifestName));
+    File manifestFile = fs.file(path.join(dir.path, _kManifestName));
     if (!manifestFile.existsSync()) {
       // We use the existence of the manifest as a proxy for this being a
       // valid replay directory. Namely, we don't validate the structure of the
@@ -608,12 +609,12 @@
   }
 
   @override
-  Future<Process> start(
+  Future<io.Process> start(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    ProcessStartMode mode: ProcessStartMode.NORMAL,
+    io.ProcessStartMode mode: io.ProcessStartMode.NORMAL,
   }) async {
     Map<String, dynamic> entry = _popEntry(executable, arguments, mode: mode);
     _ReplayProcessResult result = await _ReplayProcessResult.create(
@@ -622,13 +623,13 @@
   }
 
   @override
-  Future<ProcessResult> run(
+  Future<io.ProcessResult> run(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: SYSTEM_ENCODING,
-    Encoding stderrEncoding: SYSTEM_ENCODING,
+    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
+    Encoding stderrEncoding: io.SYSTEM_ENCODING,
   }) async {
     Map<String, dynamic> entry = _popEntry(executable, arguments,
         stdoutEncoding: stdoutEncoding, stderrEncoding: stderrEncoding);
@@ -637,13 +638,13 @@
   }
 
   @override
-  ProcessResult runSync(
+  io.ProcessResult runSync(
     String executable,
     List<String> arguments, {
     String workingDirectory,
     Map<String, String> environment,
-    Encoding stdoutEncoding: SYSTEM_ENCODING,
-    Encoding stderrEncoding: SYSTEM_ENCODING,
+    Encoding stdoutEncoding: io.SYSTEM_ENCODING,
+    Encoding stderrEncoding: io.SYSTEM_ENCODING,
   }) {
     Map<String, dynamic> entry = _popEntry(executable, arguments,
         stdoutEncoding: stdoutEncoding, stderrEncoding: stderrEncoding);
@@ -655,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, {
-    ProcessStartMode mode,
+    io.ProcessStartMode mode,
     Encoding stdoutEncoding,
     Encoding stderrEncoding,
   }) {
@@ -674,14 +675,14 @@
     );
 
     if (entry == null)
-      throw new ProcessException(executable, arguments, 'No matching invocation found');
+      throw new io.ProcessException(executable, arguments, 'No matching invocation found');
 
     entry['invoked'] = true;
     return entry;
   }
 
   @override
-  bool killPid(int pid, [ProcessSignal signal = ProcessSignal.SIGTERM]) {
+  bool killPid(int pid, [io.ProcessSignal signal = io.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 "
@@ -691,7 +692,7 @@
 
 /// A [ProcessResult] implementation that derives its data from a recording
 /// fragment.
-class _ReplayProcessResult implements ProcessResult {
+class _ReplayProcessResult implements io.ProcessResult {
   @override
   final int pid;
 
@@ -721,12 +722,12 @@
         stderr: await _getData('$basePath.stderr', entry['stderrEncoding']),
       );
     } catch (e) {
-      throw new ProcessException(executable, arguments, e.toString());
+      throw new io.ProcessException(executable, arguments, e.toString());
     }
   }
 
   static Future<dynamic> _getData(String path, String encoding) async {
-    File file = new File(path);
+    File file = fs.file(path);
     return encoding == null
         ? await file.readAsBytes()
         : await file.readAsString(encoding: _getEncodingByName(encoding));
@@ -747,12 +748,12 @@
         stderr: _getDataSync('$basePath.stderr', entry['stderrEncoding']),
       );
     } catch (e) {
-      throw new ProcessException(executable, arguments, e.toString());
+      throw new io.ProcessException(executable, arguments, e.toString());
     }
   }
 
   static dynamic _getDataSync(String path, String encoding) {
-    File file = new File(path);
+    File file = fs.file(path);
     return encoding == null
         ? file.readAsBytesSync()
         : file.readAsStringSync(encoding: _getEncodingByName(encoding));
@@ -760,13 +761,13 @@
 
   static Encoding _getEncodingByName(String encoding) {
     if (encoding == 'system')
-      return const SystemEncoding();
+      return const io.SystemEncoding();
     else if (encoding != null)
       return Encoding.getByName(encoding);
     return null;
   }
 
-  Process asProcess(bool daemon) {
+  io.Process asProcess(bool daemon) {
     assert(stdout is List<int>);
     assert(stderr is List<int>);
     return new _ReplayProcess(this, daemon);
@@ -774,7 +775,7 @@
 }
 
 /// A [Process] implementation derives its data from a recording fragment.
-class _ReplayProcess implements Process {
+class _ReplayProcess implements io.Process {
   @override
   final int pid;
 
@@ -830,10 +831,10 @@
   set exitCode(Future<int> exitCode) => throw new UnsupportedError('set exitCode');
 
   @override
-  IOSink get stdin => throw new UnimplementedError();
+  io.IOSink get stdin => throw new UnimplementedError();
 
   @override
-  bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]) {
+  bool kill([io.ProcessSignal signal = io.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 2d86985..8af34bd 100644
--- a/packages/flutter_tools/lib/src/base/utils.dart
+++ b/packages/flutter_tools/lib/src/base/utils.dart
@@ -4,19 +4,21 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+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';
+
 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
-    Platform.environment['TRAVIS'] == 'true' ||
-    Platform.environment['CONTINUOUS_INTEGRATION'] == 'true' ||
-    Platform.environment['CHROME_HEADLESS'] == '1';
+    io.Platform.environment['TRAVIS'] == 'true' ||
+    io.Platform.environment['CONTINUOUS_INTEGRATION'] == 'true' ||
+    io.Platform.environment['CHROME_HEADLESS'] == '1';
 }
 
 String hex(List<int> bytes) {
@@ -63,7 +65,7 @@
 
   while (true) {
     String name = '${baseName}_${i.toString().padLeft(2, '0')}.$ext';
-    File file = new File(path.join(dir.path, name));
+    File file = fs.file(path.join(dir.path, name));
     if (!file.existsSync())
       return file;
     i++;
@@ -91,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 = Directory.current.path + Platform.pathSeparator;
+  String cwd = fs.currentDirectory.path + io.Platform.pathSeparator;
   return fullPath.startsWith(cwd) ?  fullPath.substring(cwd.length) : fullPath;
 }
 
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
index 7aee1d5..9c898a4 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -3,13 +3,14 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:flutter_tools/src/dart/pub.dart';
 import 'package:flutter_tools/src/dart/summary.dart';
 import 'package:path/path.dart' as path;
 
 import 'base/context.dart';
+import 'base/file_system.dart';
 import 'base/logger.dart';
 import 'base/net.dart';
 import 'base/os.dart';
@@ -53,7 +54,7 @@
     if (!_lockEnabled)
       return null;
     assert(_lock == null);
-    _lock = new File(path.join(flutterRoot, 'bin', 'cache', 'lockfile')).openSync(mode: FileMode.WRITE);
+    _lock = fs.file(path.join(flutterRoot, 'bin', 'cache', 'lockfile')).openSync(mode: FileMode.WRITE);
     bool locked = false;
     bool printed = false;
     while (!locked) {
@@ -83,7 +84,7 @@
 
   static String get dartSdkVersion {
     if (_dartSdkVersion == null) {
-      _dartSdkVersion = Platform.version;
+      _dartSdkVersion = io.Platform.version;
     }
     return _dartSdkVersion;
   }
@@ -92,7 +93,7 @@
 
   static String get engineRevision {
     if (_engineRevision == null) {
-      File revisionFile = new File(path.join(flutterRoot, 'bin', 'internal', 'engine.version'));
+      File revisionFile = fs.file(path.join(flutterRoot, 'bin', 'internal', 'engine.version'));
       if (revisionFile.existsSync())
         _engineRevision = revisionFile.readAsStringSync().trim();
     }
@@ -104,14 +105,14 @@
   /// Return the top-level directory in the cache; this is `bin/cache`.
   Directory getRoot() {
     if (_rootOverride != null)
-      return new Directory(path.join(_rootOverride.path, 'bin', 'cache'));
+      return fs.directory(path.join(_rootOverride.path, 'bin', 'cache'));
     else
-      return new Directory(path.join(flutterRoot, 'bin', 'cache'));
+      return fs.directory(path.join(flutterRoot, 'bin', 'cache'));
   }
 
   /// Return a directory in the cache dir. For `pkg`, this will return `bin/cache/pkg`.
   Directory getCacheDir(String name) {
-    Directory dir = new Directory(path.join(getRoot().path, name));
+    Directory dir = fs.directory(path.join(getRoot().path, name));
     if (!dir.existsSync())
       dir.createSync(recursive: true);
     return dir;
@@ -123,11 +124,11 @@
   /// Get a named directory from with the cache's artifact directory; for example,
   /// `material_fonts` would return `bin/cache/artifacts/material_fonts`.
   Directory getArtifactDirectory(String name) {
-    return new Directory(path.join(getCacheArtifacts().path, name));
+    return fs.directory(path.join(getCacheArtifacts().path, name));
   }
 
   String getVersionFor(String artifactName) {
-    File versionFile = new File(path.join(_rootOverride?.path ?? flutterRoot, 'bin', 'internal', '$artifactName.version'));
+    File versionFile = fs.file(path.join(_rootOverride?.path ?? flutterRoot, 'bin', 'internal', '$artifactName.version'));
     return versionFile.existsSync() ? versionFile.readAsStringSync().trim() : null;
   }
 
@@ -141,7 +142,7 @@
   }
 
   File getStampFileFor(String artifactName) {
-    return new File(path.join(getRoot().path, '$artifactName.stamp'));
+    return fs.file(path.join(getRoot().path, '$artifactName.stamp'));
   }
 
   bool isUpToDate() {
@@ -157,11 +158,11 @@
     Uri url = Uri.parse(urlStr);
     Directory thirdPartyDir = getArtifactDirectory('third_party');
 
-    Directory serviceDir = new Directory(path.join(thirdPartyDir.path, serviceName));
+    Directory serviceDir = fs.directory(path.join(thirdPartyDir.path, serviceName));
     if (!serviceDir.existsSync())
       serviceDir.createSync(recursive: true);
 
-    File cachedFile = new File(path.join(serviceDir.path, url.pathSegments.last));
+    File cachedFile = fs.file(path.join(serviceDir.path, url.pathSegments.last));
     if (!cachedFile.existsSync()) {
       try {
         await _downloadFileToCache(url, cachedFile, unzip);
@@ -198,7 +199,7 @@
       if (location is Directory && !location.existsSync())
         location.createSync(recursive: true);
 
-      File tempFile = new File(path.join(Directory.systemTemp.path, '${url.toString().hashCode}.zip'));
+      File tempFile = fs.file(path.join(fs.systemTempDirectory.path, '${url.toString().hashCode}.zip'));
       tempFile.writeAsBytesSync(fileBytes, flush: true);
       os.unzip(tempFile, location);
       tempFile.deleteSync();
@@ -263,9 +264,9 @@
 
     if (cache.includeAllPlatforms)
       dirs.addAll(<String>['ios', 'ios-profile', 'ios-release', 'linux-x64']);
-    else if (Platform.isMacOS)
+    else if (io.Platform.isMacOS)
       dirs.addAll(<String>['ios', 'ios-profile', 'ios-release']);
-    else if (Platform.isLinux)
+    else if (io.Platform.isLinux)
       dirs.add('linux-x64');
 
     return dirs;
@@ -277,9 +278,9 @@
       return <List<String>>[]
         ..addAll(_osxToolsDirs)
         ..addAll(_linuxToolsDirs);
-    else if (Platform.isMacOS)
+    else if (io.Platform.isMacOS)
       return _osxToolsDirs;
-    else if (Platform.isLinux)
+    else if (io.Platform.isLinux)
       return _linuxToolsDirs;
     else
       return <List<String>>[];
@@ -302,24 +303,24 @@
     for (String pkgName in _getPackageDirs()) {
       String pkgPath = path.join(pkgDir.path, pkgName);
       String dotPackagesPath = path.join(pkgPath, '.packages');
-      if (!new Directory(pkgPath).existsSync())
+      if (!fs.directory(pkgPath).existsSync())
         return false;
-      if (!new File(dotPackagesPath).existsSync())
+      if (!fs.file(dotPackagesPath).existsSync())
         return false;
     }
 
-    if (!new File(path.join(pkgDir.path, kSkyEngine, kSdkBundle)).existsSync())
+    if (!fs.file(path.join(pkgDir.path, kSkyEngine, kSdkBundle)).existsSync())
       return false;
 
     Directory engineDir = cache.getArtifactDirectory(kName);
     for (String dirName in _getEngineDirs()) {
-      Directory dir = new Directory(path.join(engineDir.path, dirName));
+      Directory dir = fs.directory(path.join(engineDir.path, dirName));
       if (!dir.existsSync())
         return false;
     }
 
     for (List<String> toolsDir in _getToolsDirs()) {
-      Directory dir = new Directory(path.join(engineDir.path, toolsDir[0]));
+      Directory dir = fs.directory(path.join(engineDir.path, toolsDir[0]));
       if (!dir.existsSync())
         return false;
     }
@@ -334,7 +335,7 @@
     Directory pkgDir = cache.getCacheDir('pkg');
     for (String pkgName in _getPackageDirs()) {
       String pkgPath = path.join(pkgDir.path, pkgName);
-      Directory dir = new Directory(pkgPath);
+      Directory dir = fs.directory(pkgPath);
       if (dir.existsSync())
         dir.deleteSync(recursive: true);
       await _downloadItem('Downloading package $pkgName...', url + pkgName + '.zip', pkgDir);
@@ -354,12 +355,12 @@
       engineDir.deleteSync(recursive: true);
 
     for (String dirName in _getEngineDirs()) {
-      Directory dir = new Directory(path.join(engineDir.path, dirName));
+      Directory dir = fs.directory(path.join(engineDir.path, dirName));
       await _downloadItem('Downloading engine artifacts $dirName...',
         url + dirName + '/artifacts.zip', dir);
-      File frameworkZip = new File(path.join(dir.path, 'Flutter.framework.zip'));
+      File frameworkZip = fs.file(path.join(dir.path, 'Flutter.framework.zip'));
       if (frameworkZip.existsSync()) {
-        Directory framework = new Directory(path.join(dir.path, 'Flutter.framework'));
+        Directory framework = fs.directory(path.join(dir.path, 'Flutter.framework'));
         framework.createSync();
         os.unzip(frameworkZip, framework);
       }
@@ -368,7 +369,7 @@
     for (List<String> toolsDir in _getToolsDirs()) {
       String cacheDir = toolsDir[0];
       String urlPath = toolsDir[1];
-      Directory dir = new Directory(path.join(engineDir.path, cacheDir));
+      Directory dir = fs.directory(path.join(engineDir.path, cacheDir));
       await _downloadItem('Downloading $cacheDir tools...', url + urlPath, dir);
       _makeFilesExecutable(dir);
     }
diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart
index 9b34e38..f46ce8d 100644
--- a/packages/flutter_tools/lib/src/commands/analyze.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze.dart
@@ -3,8 +3,8 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
+import '../base/file_system.dart';
 import '../runner/flutter_command.dart';
 import 'analyze_continuously.dart';
 import 'analyze_once.dart';
@@ -46,7 +46,7 @@
       return false;
 
     // Or we're not in a project directory.
-    if (!new File('pubspec.yaml').existsSync())
+    if (!fs.file('pubspec.yaml').existsSync())
       return false;
 
     return super.shouldRunPub;
diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart
index 2e3ea36..69768ad 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_base.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart
@@ -3,11 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:args/args.dart';
 import 'package:path/path.dart' as path;
 
+import '../base/file_system.dart';
 import '../base/utils.dart';
 import '../cache.dart';
 import '../globals.dart';
@@ -25,7 +26,7 @@
   void dumpErrors(Iterable<String> errors) {
     if (argResults['write'] != null) {
       try {
-        final RandomAccessFile resultsFile = new File(argResults['write']).openSync(mode: FileMode.WRITE);
+        final RandomAccessFile resultsFile = fs.file(argResults['write']).openSync(mode: FileMode.WRITE);
         try {
           resultsFile.lockSync();
           resultsFile.writeStringSync(errors.join('\n'));
@@ -45,7 +46,7 @@
       'issues': errorCount,
       'missingDartDocs': membersMissingDocumentation
     };
-    new File(benchmarkOut).writeAsStringSync(toPrettyJson(data));
+    fs.file(benchmarkOut).writeAsStringSync(toPrettyJson(data));
     printStatus('Analysis benchmark written to $benchmarkOut ($data).');
   }
 
@@ -58,11 +59,11 @@
   if (fileList == null || fileList.isEmpty)
     fileList = <String>[path.current];
   String root = path.normalize(path.absolute(Cache.flutterRoot));
-  String prefix = root + Platform.pathSeparator;
+  String prefix = root + io.Platform.pathSeparator;
   for (String file in fileList) {
     file = path.normalize(path.absolute(file));
     if (file == root || file.startsWith(prefix))
       return true;
   }
   return false;
-}
\ No newline at end of file
+}
diff --git a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
index b8e5534..23ce702 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
@@ -4,12 +4,13 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+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/logger.dart';
 import '../base/process_manager.dart';
 import '../base/utils.dart';
@@ -42,8 +43,8 @@
       for (String projectPath in directories)
         printTrace('  ${path.relative(projectPath)}');
     } else {
-      directories = <String>[Directory.current.path];
-      analysisTarget = Directory.current.path;
+      directories = <String>[fs.currentDirectory.path];
+      analysisTarget = fs.currentDirectory.path;
     }
 
     AnalysisServer server = new AnalysisServer(dartSdkPath, directories);
@@ -78,7 +79,7 @@
       // Remove errors for deleted files, sort, and print errors.
       final List<AnalysisError> errors = <AnalysisError>[];
       for (String path in analysisErrors.keys.toList()) {
-        if (FileSystemEntity.isFileSync(path)) {
+        if (fs.isFileSync(path)) {
           errors.addAll(analysisErrors[path]);
         } else {
           analysisErrors.remove(path);
@@ -149,7 +150,7 @@
   final String sdk;
   final List<String> directories;
 
-  Process _process;
+  io.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/analyze_once.dart b/packages/flutter_tools/lib/src/commands/analyze_once.dart
index 7b4c266..8792330 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_once.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_once.dart
@@ -4,13 +4,13 @@
 
 import 'dart:async';
 import 'dart:collection';
-import 'dart:io';
 
 import 'package:args/args.dart';
 import 'package:path/path.dart' as path;
 import 'package:yaml/yaml.dart' as yaml;
 
 import '../base/common.dart';
+import '../base/file_system.dart';
 import '../cache.dart';
 import '../dart/analysis.dart';
 import '../globals.dart';
@@ -36,11 +36,11 @@
     for (String file in argResults.rest.toList()) {
       file = path.normalize(path.absolute(file));
       String root = path.rootPrefix(file);
-      dartFiles.add(new File(file));
+      dartFiles.add(fs.file(file));
       while (file != root) {
         file = path.dirname(file);
-        if (FileSystemEntity.isFileSync(path.join(file, 'pubspec.yaml'))) {
-          pubSpecDirectories.add(new Directory(file));
+        if (fs.isFileSync(path.join(file, 'pubspec.yaml'))) {
+          pubSpecDirectories.add(fs.directory(file));
           break;
         }
       }
@@ -54,7 +54,7 @@
 
     if (currentDirectory  && !flutterRepo) {
       // ./*.dart
-      Directory currentDirectory = new Directory('.');
+      Directory currentDirectory = fs.directory('.');
       bool foundOne = false;
       for (FileSystemEntity entry in currentDirectory.listSync()) {
         if (isDartFile(entry)) {
@@ -68,7 +68,7 @@
 
     if (currentPackage && !flutterRepo) {
       // **/.*dart
-      Directory currentDirectory = new Directory('.');
+      Directory currentDirectory = fs.directory('.');
       _collectDartFiles(currentDirectory, dartFiles);
       pubSpecDirectories.add(currentDirectory);
     }
@@ -89,18 +89,18 @@
     PackageDependencyTracker dependencies = new PackageDependencyTracker();
     for (Directory directory in pubSpecDirectories) {
       String pubSpecYamlPath = path.join(directory.path, 'pubspec.yaml');
-      File pubSpecYamlFile = new File(pubSpecYamlPath);
+      File pubSpecYamlFile = fs.file(pubSpecYamlPath);
       if (pubSpecYamlFile.existsSync()) {
         // we are analyzing the actual canonical source for this package;
         // make sure we remember that, in case all the packages are actually
         // pointing elsewhere somehow.
-        yaml.YamlMap pubSpecYaml = yaml.loadYaml(new File(pubSpecYamlPath).readAsStringSync());
+        yaml.YamlMap pubSpecYaml = yaml.loadYaml(fs.file(pubSpecYamlPath).readAsStringSync());
         String packageName = pubSpecYaml['name'];
         String packagePath = path.normalize(path.absolute(path.join(directory.path, 'lib')));
         dependencies.addCanonicalCase(packageName, packagePath, pubSpecYamlPath);
       }
       String dotPackagesPath = path.join(directory.path, '.packages');
-      File dotPackages = new File(dotPackagesPath);
+      File dotPackages = fs.file(dotPackagesPath);
       if (dotPackages.existsSync()) {
         // this directory has opinions about what we should be using
         dotPackages
@@ -228,7 +228,7 @@
 
   List<File> _collectDartFiles(Directory dir, List<File> collected, {FileFilter exclude}) {
     // Bail out in case of a .dartignore.
-    if (FileSystemEntity.isFileSync(path.join(path.dirname(dir.path), '.dartignore')))
+    if (fs.isFileSync(path.join(path.dirname(dir.path), '.dartignore')))
       return collected;
 
     for (FileSystemEntity entity in dir.listSync(recursive: false, followLinks: false)) {
diff --git a/packages/flutter_tools/lib/src/commands/build.dart b/packages/flutter_tools/lib/src/commands/build.dart
index 21eff64..1957d85 100644
--- a/packages/flutter_tools/lib/src/commands/build.dart
+++ b/packages/flutter_tools/lib/src/commands/build.dart
@@ -3,10 +3,11 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:meta/meta.dart';
 
+import '../base/file_system.dart';
 import '../build_info.dart';
 import '../globals.dart';
 import '../runner/flutter_command.dart';
@@ -54,14 +55,14 @@
   @mustCallSuper
   Future<Null> runCommand() async {
     if (isRunningOnBot) {
-      File dotPackages = new File('.packages');
+      File dotPackages = fs.file('.packages');
       printStatus('Contents of .packages:');
       if (dotPackages.existsSync())
         printStatus(dotPackages.readAsStringSync());
       else
         printError('File not found: ${dotPackages.absolute.path}');
 
-      File pubspecLock = new File('pubspec.lock');
+      File pubspecLock = fs.file('pubspec.lock');
       printStatus('Contents of pubspec.lock:');
       if (pubspecLock.existsSync())
         printStatus(pubspecLock.readAsStringSync());
@@ -86,8 +87,8 @@
 
   @override
   Future<Null> runCommand() async {
-    Directory buildDir = new Directory(getBuildDirectory());
-    printStatus("Deleting '${buildDir.path}${Platform.pathSeparator}'.");
+    Directory buildDir = fs.directory(getBuildDirectory());
+    printStatus("Deleting '${buildDir.path}${io.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 e5b31a9..f8e8c44 100644
--- a/packages/flutter_tools/lib/src/commands/build_aot.dart
+++ b/packages/flutter_tools/lib/src/commands/build_aot.dart
@@ -3,11 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:path/path.dart' as path;
 
 import '../base/common.dart';
+import '../base/file_system.dart';
 import '../base/logger.dart';
 import '../base/process.dart';
 import '../base/utils.dart';
@@ -64,7 +65,7 @@
     if (outputPath == null)
       throwToolExit(null);
 
-    printStatus('Built to $outputPath${Platform.pathSeparator}.');
+    printStatus('Built to $outputPath${io.Platform.pathSeparator}.');
   }
 }
 
@@ -142,7 +143,7 @@
     }
   }
 
-  Directory outputDir = new Directory(outputPath);
+  Directory outputDir = fs.directory(outputPath);
   outputDir.createSync(recursive: true);
   String vmIsolateSnapshot = path.join(outputDir.path, 'snapshot_aot_vmisolate');
   String isolateSnapshot = path.join(outputDir.path, 'snapshot_aot_isolate');
@@ -201,7 +202,7 @@
       assert(false);
   }
 
-  List<String> missingFiles = filePaths.where((String p) => !FileSystemEntity.isFileSync(p)).toList();
+  List<String> missingFiles = filePaths.where((String p) => !fs.isFileSync(p)).toList();
   if (missingFiles.isNotEmpty) {
     printError('Missing files: $missingFiles');
     return null;
diff --git a/packages/flutter_tools/lib/src/commands/build_apk.dart b/packages/flutter_tools/lib/src/commands/build_apk.dart
index 114b862..b6a1b8f 100644
--- a/packages/flutter_tools/lib/src/commands/build_apk.dart
+++ b/packages/flutter_tools/lib/src/commands/build_apk.dart
@@ -4,14 +4,13 @@
 
 import 'dart:async';
 import 'dart:convert' show JSON;
-import 'dart:io';
 
 import 'package:path/path.dart' as path;
 
 import '../android/android_sdk.dart';
 import '../android/gradle.dart';
 import '../base/common.dart';
-import '../base/file_system.dart' show ensureDirectoryExists;
+import '../base/file_system.dart';
 import '../base/logger.dart';
 import '../base/os.dart';
 import '../base/process.dart';
@@ -49,7 +48,7 @@
   Directory _assetDir;
 
   _AssetBuilder(this.outDir, String assetDirName) {
-    _assetDir = new Directory('${outDir.path}/$assetDirName');
+    _assetDir = fs.directory('${outDir.path}/$assetDirName');
     _assetDir.createSync(recursive:  true);
   }
 
@@ -73,10 +72,10 @@
   File _jarsigner;
 
   _ApkBuilder(this.sdk) {
-    _androidJar = new File(sdk.androidJarPath);
-    _aapt = new File(sdk.aaptPath);
-    _dx = new File(sdk.dxPath);
-    _zipalign = new File(sdk.zipalignPath);
+    _androidJar = fs.file(sdk.androidJarPath);
+    _aapt = fs.file(sdk.aaptPath);
+    _dx = fs.file(sdk.dxPath);
+    _zipalign = fs.file(sdk.zipalignPath);
     _jarsigner = os.which('jarsigner');
   }
 
@@ -284,8 +283,8 @@
   Map<String, File> extraFiles
 ) async {
   _ApkComponents components = new _ApkComponents();
-  components.manifest = new File(manifest);
-  components.resources = resources == null ? null : new Directory(resources);
+  components.manifest = fs.file(manifest);
+  components.resources = resources == null ? null : fs.directory(resources);
   components.extraFiles = extraFiles != null ? extraFiles : <String, File>{};
 
   if (tools.isLocalEngine) {
@@ -293,21 +292,21 @@
     String enginePath = tools.engineSrcPath;
     String buildDir = tools.getEngineArtifactsDirectory(platform, buildMode).path;
 
-    components.icuData = new File('$enginePath/third_party/icu/android/icudtl.dat');
+    components.icuData = fs.file('$enginePath/third_party/icu/android/icudtl.dat');
     components.jars = <File>[
-      new File('$buildDir/gen/flutter/shell/platform/android/android/classes.dex.jar')
+      fs.file('$buildDir/gen/flutter/shell/platform/android/android/classes.dex.jar')
     ];
-    components.libSkyShell = new File('$buildDir/gen/flutter/shell/platform/android/android/android/libs/$abiDir/libsky_shell.so');
-    components.debugKeystore = new File('$enginePath/build/android/ant/chromium-debug.keystore');
+    components.libSkyShell = fs.file('$buildDir/gen/flutter/shell/platform/android/android/android/libs/$abiDir/libsky_shell.so');
+    components.debugKeystore = fs.file('$enginePath/build/android/ant/chromium-debug.keystore');
   } else {
     Directory artifacts = tools.getEngineArtifactsDirectory(platform, buildMode);
 
-    components.icuData = new File(path.join(artifacts.path, 'icudtl.dat'));
+    components.icuData = fs.file(path.join(artifacts.path, 'icudtl.dat'));
     components.jars = <File>[
-      new File(path.join(artifacts.path, 'classes.dex.jar'))
+      fs.file(path.join(artifacts.path, 'classes.dex.jar'))
     ];
-    components.libSkyShell = new File(path.join(artifacts.path, 'libsky_shell.so'));
-    components.debugKeystore = new File(path.join(artifacts.path, 'chromium-debug.keystore'));
+    components.libSkyShell = fs.file(path.join(artifacts.path, 'libsky_shell.so'));
+    components.debugKeystore = fs.file(path.join(artifacts.path, 'chromium-debug.keystore'));
   }
 
   await parseServiceConfigs(components.services, jars: components.jars);
@@ -338,7 +337,7 @@
   assert(platform != null);
   assert(buildMode != null);
 
-  Directory tempDir = Directory.systemTemp.createTempSync('flutter_tools');
+  Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_tools');
 
   printTrace('Building APK; buildMode: ${getModeName(buildMode)}.');
 
@@ -350,7 +349,7 @@
       return 1;
     }
 
-    File classesDex = new File('${tempDir.path}/classes.dex');
+    File classesDex = fs.file('${tempDir.path}/classes.dex');
     builder.compileClassesDex(classesDex, components.jars);
 
     File servicesConfig =
@@ -358,7 +357,7 @@
 
     _AssetBuilder assetBuilder = new _AssetBuilder(tempDir, 'assets');
     assetBuilder.add(components.icuData, 'icudtl.dat');
-    assetBuilder.add(new File(flxPath), 'app.flx');
+    assetBuilder.add(fs.file(flxPath), 'app.flx');
     assetBuilder.add(servicesConfig, 'services.json');
 
     _AssetBuilder artifactBuilder = new _AssetBuilder(tempDir, 'artifacts');
@@ -369,7 +368,7 @@
     for (String relativePath in components.extraFiles.keys)
       artifactBuilder.add(components.extraFiles[relativePath], relativePath);
 
-    File unalignedApk = new File('${tempDir.path}/app.apk.unaligned');
+    File unalignedApk = fs.file('${tempDir.path}/app.apk.unaligned');
     builder.package(
       unalignedApk, components.manifest, assetBuilder.directory,
       artifactBuilder.directory, components.resources, buildMode
@@ -379,12 +378,12 @@
     if (signResult != 0)
       return signResult;
 
-    File finalApk = new File(outputFile);
+    File finalApk = fs.file(outputFile);
     ensureDirectoryExists(finalApk.path);
     builder.align(unalignedApk, finalApk);
 
     printTrace('calculateSha: $outputFile');
-    File apkShaFile = new File('$outputFile.sha1');
+    File apkShaFile = fs.file('$outputFile.sha1');
     apkShaFile.writeAsStringSync(calculateSha(finalApk));
 
     return 0;
@@ -417,7 +416,7 @@
     keyAlias = _kDebugKeystoreKeyAlias;
     keyPassword = _kDebugKeystorePassword;
   } else {
-    keystore = new File(keystoreInfo.keystore);
+    keystore = fs.file(keystoreInfo.keystore);
     keystorePassword = keystoreInfo.password ?? '';
     keyAlias = keystoreInfo.keyAlias ?? '';
     if (keystorePassword.isEmpty || keyAlias.isEmpty) {
@@ -442,7 +441,7 @@
   BuildMode buildMode,
   Map<String, File> extraFiles
 ) {
-  FileStat apkStat = FileStat.statSync(apkPath);
+  FileStat apkStat = fs.statSync(apkPath);
   // Note: This list of dependencies is imperfect, but will do for now. We
   // purposely don't include the .dart files, because we can load those
   // over the network without needing to rebuild (at least on Android).
@@ -453,7 +452,7 @@
   ];
   dependencies.addAll(extraFiles.values.map((File file) => file.path));
   Iterable<FileStat> dependenciesStat =
-    dependencies.map((String path) => FileStat.statSync(path));
+    dependencies.map((String path) => fs.statSync(path));
 
   if (apkStat.type == FileSystemEntityType.NOT_FOUND)
     return true;
@@ -463,11 +462,11 @@
       return true;
   }
 
-  if (!FileSystemEntity.isFileSync('$apkPath.sha1'))
+  if (!fs.isFileSync('$apkPath.sha1'))
     return true;
 
   String lastBuildType = _readBuildMeta(path.dirname(apkPath))['targetBuildType'];
-  String targetBuildType = _getTargetBuildTypeToken(platform, buildMode, new File(apkPath));
+  String targetBuildType = _getTargetBuildTypeToken(platform, buildMode, fs.file(apkPath));
   if (lastBuildType != targetBuildType)
     return true;
 
@@ -499,8 +498,8 @@
   }
 
   Map<String, File> extraFiles = <String, File>{};
-  if (FileSystemEntity.isDirectorySync(_kDefaultAssetsPath)) {
-    Directory assetsDir = new Directory(_kDefaultAssetsPath);
+  if (fs.isDirectorySync(_kDefaultAssetsPath)) {
+    Directory assetsDir = fs.directory(_kDefaultAssetsPath);
     for (FileSystemEntity entity in assetsDir.listSync(recursive: true)) {
       if (entity is File) {
         String targetPath = entity.path.substring(assetsDir.path.length);
@@ -520,10 +519,10 @@
   }
 
   if (resources != null) {
-    if (!FileSystemEntity.isDirectorySync(resources))
+    if (!fs.isDirectorySync(resources))
       throwToolExit('Resources directory "$resources" not found.');
   } else {
-    if (FileSystemEntity.isDirectorySync(_kDefaultResourcesPath))
+    if (fs.isDirectorySync(_kDefaultResourcesPath))
       resources = _kDefaultResourcesPath;
   }
 
@@ -536,7 +535,7 @@
   Status status = logger.startProgress('Building APK in ${getModeName(buildMode)} mode ($typeName)...');
 
   if (flxPath != null && flxPath.isNotEmpty) {
-    if (!FileSystemEntity.isFileSync(flxPath)) {
+    if (!fs.isFileSync(flxPath)) {
       throwToolExit('FLX does not exist: $flxPath\n'
         '(Omit the --flx option to build the FLX automatically)');
     }
@@ -561,13 +560,13 @@
   if (aotPath != null) {
     if (!isAotBuildMode(buildMode))
       throwToolExit('AOT snapshot can not be used in build mode $buildMode');
-    if (!FileSystemEntity.isDirectorySync(aotPath))
+    if (!fs.isDirectorySync(aotPath))
       throwToolExit('AOT snapshot does not exist: $aotPath');
     for (String aotFilename in kAotSnapshotFiles) {
       String aotFilePath = path.join(aotPath, aotFilename);
-      if (!FileSystemEntity.isFileSync(aotFilePath))
+      if (!fs.isFileSync(aotFilePath))
         throwToolExit('Missing AOT snapshot file: $aotFilePath');
-      components.extraFiles['assets/$aotFilename'] = new File(aotFilePath);
+      components.extraFiles['assets/$aotFilename'] = fs.file(aotFilePath);
     }
   }
 
@@ -577,13 +576,13 @@
   if (result != 0)
     throwToolExit('Build APK failed ($result)', exitCode: result);
 
-  File apkFile = new File(outputFile);
+  File apkFile = fs.file(outputFile);
   printTrace('Built $outputFile (${getSizeAsMB(apkFile.lengthSync())}).');
 
   _writeBuildMetaEntry(
     path.dirname(outputFile),
     'targetBuildType',
-    _getTargetBuildTypeToken(platform, buildMode, new File(outputFile))
+    _getTargetBuildTypeToken(platform, buildMode, fs.file(outputFile))
   );
 }
 
@@ -619,7 +618,7 @@
       target: target
     );
   } else {
-    if (!FileSystemEntity.isFileSync(_kDefaultAndroidManifestPath))
+    if (!fs.isFileSync(_kDefaultAndroidManifestPath))
       throwToolExit('Cannot build APK: missing $_kDefaultAndroidManifestPath.');
 
     return await buildAndroid(
@@ -632,7 +631,7 @@
 }
 
 Map<String, dynamic> _readBuildMeta(String buildDirectoryPath) {
-  File buildMetaFile = new File(path.join(buildDirectoryPath, 'build_meta.json'));
+  File buildMetaFile = fs.file(path.join(buildDirectoryPath, 'build_meta.json'));
   if (buildMetaFile.existsSync())
     return JSON.decode(buildMetaFile.readAsStringSync());
   return <String, dynamic>{};
@@ -641,7 +640,7 @@
 void _writeBuildMetaEntry(String buildDirectoryPath, String key, dynamic value) {
   Map<String, dynamic> meta = _readBuildMeta(buildDirectoryPath);
   meta[key] = value;
-  File buildMetaFile = new File(path.join(buildDirectoryPath, 'build_meta.json'));
+  File buildMetaFile = fs.file(path.join(buildDirectoryPath, 'build_meta.json'));
   buildMetaFile.writeAsStringSync(toPrettyJson(meta));
 }
 
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index 3d21f16..83f3e7d 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -3,12 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:path/path.dart' as path;
 
 import '../android/android.dart' as android;
 import '../base/common.dart';
+import '../base/file_system.dart';
 import '../base/utils.dart';
 import '../cache.dart';
 import '../dart/pub.dart';
@@ -72,14 +72,14 @@
 
     String flutterPackagesDirectory = path.join(flutterRoot, 'packages');
     String flutterPackagePath = path.join(flutterPackagesDirectory, 'flutter');
-    if (!FileSystemEntity.isFileSync(path.join(flutterPackagePath, 'pubspec.yaml')))
+    if (!fs.isFileSync(path.join(flutterPackagePath, 'pubspec.yaml')))
       throwToolExit('Unable to find package:flutter in $flutterPackagePath', exitCode: 2);
 
     String flutterDriverPackagePath = path.join(flutterRoot, 'packages', 'flutter_driver');
-    if (!FileSystemEntity.isFileSync(path.join(flutterDriverPackagePath, 'pubspec.yaml')))
+    if (!fs.isFileSync(path.join(flutterDriverPackagePath, 'pubspec.yaml')))
       throwToolExit('Unable to find package:flutter_driver in $flutterDriverPackagePath', exitCode: 2);
 
-    Directory projectDir = new Directory(argResults.rest.first);
+    Directory projectDir = fs.directory(argResults.rest.first);
     String dirPath = path.normalize(projectDir.absolute.path);
     String relativePath = path.relative(dirPath);
     String projectName = _normalizeProjectName(path.basename(dirPath));
@@ -139,7 +139,7 @@
 
   int _renderTemplates(String projectName, String projectDescription, String dirPath,
       String flutterPackagesDirectory, { bool renderDriverTest: false }) {
-    new Directory(dirPath).createSync(recursive: true);
+    fs.directory(dirPath).createSync(recursive: true);
 
     flutterPackagesDirectory = path.normalize(flutterPackagesDirectory);
     flutterPackagesDirectory = _relativePath(from: dirPath, to: flutterPackagesDirectory);
@@ -161,14 +161,14 @@
 
     Template createTemplate = new Template.fromName('create');
     fileCount += createTemplate.render(
-      new Directory(dirPath),
+      fs.directory(dirPath),
       templateContext, overwriteExisting: false,
       projectName: projectName
     );
 
     if (renderDriverTest) {
       Template driverTemplate = new Template.fromName('driver');
-      fileCount += driverTemplate.render(new Directory(path.join(dirPath, 'test_driver')),
+      fileCount += driverTemplate.render(fs.directory(path.join(dirPath, 'test_driver')),
           templateContext, overwriteExisting: false);
     }
 
@@ -234,7 +234,7 @@
       "Target directory '$dirPath' is within the Flutter SDK at '$flutterRoot'.";
   }
 
-  FileSystemEntityType type = FileSystemEntity.typeSync(dirPath);
+  FileSystemEntityType type = fs.typeSync(dirPath);
 
   if (type != FileSystemEntityType.NOT_FOUND) {
     switch(type) {
@@ -253,7 +253,7 @@
 String _relativePath({ String from, String to }) {
   String result = path.relative(to, from: from);
   // `path.relative()` doesn't always return a correct result: dart-lang/path#12.
-  if (FileSystemEntity.isDirectorySync(path.join(from, result)))
+  if (fs.isDirectorySync(path.join(from, result)))
     return result;
   return to;
 }
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart
index c59a8fc..4f7483d 100644
--- a/packages/flutter_tools/lib/src/commands/daemon.dart
+++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -4,11 +4,12 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+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/logger.dart';
 import '../base/utils.dart';
 import '../build_info.dart';
@@ -119,7 +120,7 @@
     dynamic id = request['id'];
 
     if (id == null) {
-      stderr.writeln('no id for request: $request');
+      io.stderr.writeln('no id for request: $request');
       return;
     }
 
@@ -234,9 +235,9 @@
           // capture the print output for testing.
           print(message.message);
         } else if (message.level == 'error') {
-          stderr.writeln(message.message);
+          io.stderr.writeln(message.message);
           if (message.stackTrace != null)
-            stderr.writeln(message.stackTrace.toString().trimRight());
+            io.stderr.writeln(message.stackTrace.toString().trimRight());
         }
       } else {
         if (message.stackTrace != null) {
@@ -302,7 +303,7 @@
     if (device == null)
       throw "device '$deviceId' not found";
 
-    if (!FileSystemEntity.isDirectorySync(projectDirectory))
+    if (!fs.isDirectorySync(projectDirectory))
       throw "'$projectDirectory' does not exist";
 
     BuildMode buildMode = getBuildModeForName(mode) ?? BuildMode.debug;
@@ -341,8 +342,8 @@
       throw '${toTitleCase(getModeName(buildMode))} mode is not supported for emulators.';
 
     // We change the current working directory for the duration of the `start` command.
-    Directory cwd = Directory.current;
-    Directory.current = new Directory(projectDirectory);
+    Directory cwd = fs.currentDirectory;
+    fs.currentDirectory = fs.directory(projectDirectory);
 
     ResidentRunner runner;
 
@@ -400,7 +401,7 @@
       } catch (error) {
         _sendAppEvent(app, 'stop', <String, dynamic>{'error': error.toString()});
       } finally {
-        Directory.current = cwd;
+        fs.currentDirectory = cwd;
         _apps.remove(app);
       }
     });
@@ -589,7 +590,7 @@
   }
 }
 
-Stream<Map<String, dynamic>> get stdinCommandStream => stdin
+Stream<Map<String, dynamic>> get stdinCommandStream => io.stdin
   .transform(UTF8.decoder)
   .transform(const LineSplitter())
   .where((String line) => line.startsWith('[{') && line.endsWith('}]'))
@@ -599,7 +600,7 @@
   });
 
 void stdoutCommandResponse(Map<String, dynamic> command) {
-  stdout.writeln('[${JSON.encode(command, toEncodable: _jsonEncodeObject)}]');
+  io.stdout.writeln('[${JSON.encode(command, toEncodable: _jsonEncodeObject)}]');
 }
 
 dynamic _jsonEncodeObject(dynamic object) {
@@ -709,9 +710,9 @@
   @override
   void printError(String message, [StackTrace stackTrace]) {
     if (logToStdout) {
-      stderr.writeln(message);
+      io.stderr.writeln(message);
       if (stackTrace != null)
-        stderr.writeln(stackTrace.toString().trimRight());
+        io.stderr.writeln(stackTrace.toString().trimRight());
     } else {
       if (stackTrace != null) {
         _sendLogEvent(<String, dynamic>{
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index ddd06f7..7486648 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -3,9 +3,10 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+import 'dart:io' as io;
 
 import '../base/common.dart';
+import '../base/file_system.dart';
 import '../base/utils.dart';
 import '../build_info.dart';
 import '../cache.dart';
@@ -174,7 +175,7 @@
       AppInstance app;
       try {
         app = daemon.appDomain.startApp(
-          device, Directory.current.path, targetFile, route,
+          device, fs.currentDirectory.path, targetFile, route,
           getBuildMode(), argResults['start-paused'], hotMode);
       } catch (error) {
         throwToolExit(error.toString());
@@ -217,7 +218,7 @@
     String pidFile = argResults['pid-file'];
     if (pidFile != null) {
       // Write our pid to the file.
-      new File(pidFile).writeAsStringSync(pid.toString());
+      fs.file(pidFile).writeAsStringSync(io.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 f2208e5..398d213 100644
--- a/packages/flutter_tools/lib/src/commands/screenshot.dart
+++ b/packages/flutter_tools/lib/src/commands/screenshot.dart
@@ -3,12 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+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/utils.dart';
 import '../device.dart';
 import '../globals.dart';
@@ -72,7 +73,7 @@
   Future<Null> runCommand() async {
     File outputFile;
     if (argResults.wasParsed(_kOut))
-      outputFile = new File(argResults[_kOut]);
+      outputFile = fs.file(argResults[_kOut]);
 
     if (argResults[_kSkia] != null) {
       return runSkia(outputFile);
@@ -82,7 +83,7 @@
   }
 
   Future<Null> runScreenshot(File outputFile) async {
-    outputFile ??= getUniqueFile(Directory.current, 'flutter', 'png');
+    outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'png');
     try {
       if (!await device.takeScreenshot(outputFile))
         throwToolExit('Screenshot failed');
@@ -105,10 +106,10 @@
     http.StreamedResponse skpResponse;
     try {
       skpResponse = await new http.Request('GET', skpUri).send();
-    } on SocketException catch (e) {
+    } on io.SocketException catch (e) {
       throwToolExit('Skia screenshot failed: $skpUri\n$e\n\n$errorHelpText');
     }
-    if (skpResponse.statusCode != HttpStatus.OK) {
+    if (skpResponse.statusCode != io.HttpStatus.OK) {
       String error = await skpResponse.stream.toStringStream().join();
       throwToolExit('Error: $error\n\n$errorHelpText');
     }
@@ -121,10 +122,10 @@
           'file', skpResponse.stream, skpResponse.contentLength));
 
       http.StreamedResponse postResponse = await postRequest.send();
-      if (postResponse.statusCode != HttpStatus.OK)
+      if (postResponse.statusCode != io.HttpStatus.OK)
         throwToolExit('Failed to post Skia picture to skiaserve.\n\n$errorHelpText');
     } else {
-      outputFile ??= getUniqueFile(Directory.current, 'flutter', 'skp');
+      outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'skp');
       IOSink sink = outputFile.openWrite();
       await sink.addStream(skpResponse.stream);
       await sink.close();
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index 9e6ed72..11e4a2b 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -3,12 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+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/logger.dart';
 import '../base/process_manager.dart';
 import '../base/os.dart';
@@ -39,7 +40,7 @@
       help: 'Where to store coverage information (if coverage is enabled).'
     );
     commandValidator = () {
-      if (!FileSystemEntity.isFileSync('pubspec.yaml')) {
+      if (!fs.isFileSync('pubspec.yaml')) {
         throwToolExit(
           'Error: No pubspec.yaml file found in the current working directory.\n'
           'Run this command from the root of your project. Test files must be\n'
@@ -58,31 +59,31 @@
   Iterable<String> _findTests(Directory directory) {
     return directory.listSync(recursive: true, followLinks: false)
                     .where((FileSystemEntity entity) => entity.path.endsWith('_test.dart') &&
-                      FileSystemEntity.isFileSync(entity.path))
+                      fs.isFileSync(entity.path))
                     .map((FileSystemEntity entity) => path.absolute(entity.path));
   }
 
   Directory get _currentPackageTestDir {
     // We don't scan the entire package, only the test/ subdirectory, so that
     // files with names like like "hit_test.dart" don't get run.
-    return new Directory('test');
+    return fs.directory('test');
   }
 
   Future<int> _runTests(List<String> testArgs, Directory testDirectory) async {
-    Directory currentDirectory = Directory.current;
+    Directory currentDirectory = fs.currentDirectory;
     try {
       if (testDirectory != null) {
         printTrace('switching to directory $testDirectory to run tests');
         PackageMap.globalPackagesPath = path.normalize(path.absolute(PackageMap.globalPackagesPath));
-        Directory.current = testDirectory;
+        fs.currentDirectory = testDirectory;
       }
       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 $exitCode');
-      return exitCode;
+      printTrace('test package returned with exit code ${io.exitCode}');
+      return io.exitCode;
     } finally {
-      Directory.current = currentDirectory;
+      fs.currentDirectory = currentDirectory;
     }
   }
 
@@ -94,7 +95,7 @@
       return false;
 
     String coveragePath = argResults['coverage-path'];
-    File coverageFile = new File(coveragePath)
+    File coverageFile = fs.file(coveragePath)
       ..createSync(recursive: true)
       ..writeAsStringSync(coverageData, flush: true);
     printTrace('wrote coverage data to $coveragePath (size=${coverageData.length})');
@@ -109,7 +110,7 @@
         return false;
       }
 
-      if (!FileSystemEntity.isFileSync(baseCoverageData)) {
+      if (!fs.isFileSync(baseCoverageData)) {
         printError('Missing "$baseCoverageData". Unable to merge coverage data.');
         return false;
       }
@@ -124,10 +125,10 @@
         return false;
       }
 
-      Directory tempDir = Directory.systemTemp.createTempSync('flutter_tools');
+      Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_tools');
       try {
         File sourceFile = coverageFile.copySync(path.join(tempDir.path, 'lcov.source.info'));
-        ProcessResult result = processManager.runSync('lcov', <String>[
+        io.ProcessResult result = processManager.runSync('lcov', <String>[
           '--add-tracefile', baseCoverageData,
           '--add-tracefile', sourceFile.path,
           '--output-file', coverageFile.path,
@@ -164,8 +165,8 @@
     if (argResults['coverage'])
       testArgs.insert(0, '--concurrency=1');
 
-    final String shellPath = tools.getHostToolPath(HostTool.SkyShell) ?? Platform.environment['SKY_SHELL'];
-    if (!FileSystemEntity.isFileSync(shellPath))
+    final String shellPath = tools.getHostToolPath(HostTool.SkyShell) ?? io.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/commands/trace.dart b/packages/flutter_tools/lib/src/commands/trace.dart
index 1bbaf6f..db011bf 100644
--- a/packages/flutter_tools/lib/src/commands/trace.dart
+++ b/packages/flutter_tools/lib/src/commands/trace.dart
@@ -4,11 +4,11 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
 
 import 'package:path/path.dart' as path;
 
 import '../base/common.dart';
+import '../base/file_system.dart';
 import '../base/utils.dart';
 import '../build_info.dart';
 import '../cache.dart';
@@ -90,9 +90,9 @@
     File localFile;
 
     if (argResults['out'] != null) {
-      localFile = new File(argResults['out']);
+      localFile = fs.file(argResults['out']);
     } else {
-      localFile = getUniqueFile(Directory.current, 'trace', 'json');
+      localFile = getUniqueFile(fs.currentDirectory, 'trace', 'json');
     }
 
     await localFile.writeAsString(JSON.encode(timeline));
@@ -161,7 +161,7 @@
 /// store it to build/start_up_info.json.
 Future<Null> downloadStartupTrace(VMService observatory) async {
   String traceInfoFilePath = path.join(getBuildDirectory(), 'start_up_info.json');
-  File traceInfoFile = new File(traceInfoFilePath);
+  File traceInfoFile = fs.file(traceInfoFilePath);
 
   // Delete old startup data, if any.
   if (await traceInfoFile.exists())
diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart
index 30a869f..90b62bd 100644
--- a/packages/flutter_tools/lib/src/commands/update_packages.dart
+++ b/packages/flutter_tools/lib/src/commands/update_packages.dart
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:path/path.dart' as path;
 
+import '../base/file_system.dart';
 import '../base/logger.dart';
 import '../base/net.dart';
 import '../cache.dart';
@@ -36,10 +36,10 @@
     Status status = logger.startProgress("Downloading lcov data for package:flutter...");
     final List<int> data = await fetchUrl(Uri.parse('https://storage.googleapis.com/flutter_infra/flutter/coverage/lcov.info'));
     final String coverageDir = path.join(Cache.flutterRoot, 'packages/flutter/coverage');
-    new File(path.join(coverageDir, 'lcov.base.info'))
+    fs.file(path.join(coverageDir, 'lcov.base.info'))
       ..createSync(recursive: true)
       ..writeAsBytesSync(data, flush: true);
-    new File(path.join(coverageDir, 'lcov.info'))
+    fs.file(path.join(coverageDir, 'lcov.info'))
       ..createSync(recursive: true)
       ..writeAsBytesSync(data, flush: true);
     status.stop();
diff --git a/packages/flutter_tools/lib/src/dart/analysis.dart b/packages/flutter_tools/lib/src/dart/analysis.dart
index 907d867..62d20b6 100644
--- a/packages/flutter_tools/lib/src/dart/analysis.dart
+++ b/packages/flutter_tools/lib/src/dart/analysis.dart
@@ -3,7 +3,7 @@
 // found in the LICENSE file.
 
 import 'dart:collection';
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/file_system/file_system.dart' as file_system;
@@ -27,6 +27,8 @@
 import 'package:plugin/manager.dart';
 import 'package:plugin/plugin.dart';
 
+import '../base/file_system.dart';
+
 class AnalysisDriver {
   Set<Source> _analyzedSources = new HashSet<Source>();
 
@@ -97,7 +99,7 @@
 
     // Create our list of resolvers.
     List<UriResolver> resolvers = <UriResolver>[];
-    
+
     // Look for an embedder.
     EmbedderYamlLocator locator = new EmbedderYamlLocator(packageMap);
     if (locator.embedderYamls.isNotEmpty) {
@@ -123,7 +125,7 @@
     if (options.packageRootPath != null) {
       ContextBuilderOptions builderOptions = new ContextBuilderOptions();
       builderOptions.defaultPackagesDirectoryPath = options.packageRootPath;
-      ContextBuilder builder = new ContextBuilder(resourceProvider, null, null, 
+      ContextBuilder builder = new ContextBuilder(resourceProvider, null, null,
           options: builderOptions);
       PackageMapUriResolver packageUriResolver = new PackageMapUriResolver(resourceProvider,
           builder.convertPackagesToMap(builder.createPackageMap('')));
@@ -183,7 +185,7 @@
 }
 
 class AnalysisErrorDescription {
-  static Directory cwd = Directory.current.absolute;
+  static Directory cwd = fs.currentDirectory.absolute;
 
   final AnalysisError error;
   final LineInfo line;
@@ -238,10 +240,10 @@
   Map<Object, Object> analysisOptions;
 
   /// Out sink for logging.
-  IOSink outSink = stdout;
+  io.IOSink outSink = io.stdout;
 
   /// Error sink for logging.
-  IOSink errorSink = stderr;
+  io.IOSink errorSink = io.stderr;
 }
 
 class PackageInfo {
@@ -267,8 +269,8 @@
 }
 
 class _StdLogger extends Logger {
-  final IOSink outSink;
-  final IOSink errorSink;
+  final io.IOSink outSink;
+  final io.IOSink errorSink;
   _StdLogger({this.outSink, this.errorSink});
 
   @override
diff --git a/packages/flutter_tools/lib/src/dart/package_map.dart b/packages/flutter_tools/lib/src/dart/package_map.dart
index 8ea0dbc..09bab80 100644
--- a/packages/flutter_tools/lib/src/dart/package_map.dart
+++ b/packages/flutter_tools/lib/src/dart/package_map.dart
@@ -2,15 +2,15 @@
 // 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:package_config/packages_file.dart' as packages_file;
 import 'package:path/path.dart' as path;
 
+import '../base/file_system.dart';
+
 const String kPackagesFileName = '.packages';
 
 Map<String, Uri> _parse(String packagesPath) {
-  List<int> source = new File(packagesPath).readAsBytesSync();
+  List<int> source = fs.file(packagesPath).readAsBytesSync();
   return packages_file.parse(source, new Uri.file(packagesPath));
 }
 
@@ -51,11 +51,11 @@
   }
 
   String checkValid() {
-    if (FileSystemEntity.isFileSync(packagesPath))
+    if (fs.isFileSync(packagesPath))
       return null;
     String message = '$packagesPath does not exist.';
     String pubspecPath = path.absolute(path.dirname(packagesPath), 'pubspec.yaml');
-    if (FileSystemEntity.isFileSync(pubspecPath))
+    if (fs.isFileSync(pubspecPath))
       message += '\nDid you run "flutter packages get" in this directory?';
     else
       message += '\nDid you run this command from the same directory as your pubspec.yaml file?';
diff --git a/packages/flutter_tools/lib/src/dart/pub.dart b/packages/flutter_tools/lib/src/dart/pub.dart
index be4a48e..5b3db66 100644
--- a/packages/flutter_tools/lib/src/dart/pub.dart
+++ b/packages/flutter_tools/lib/src/dart/pub.dart
@@ -3,11 +3,11 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:path/path.dart' as path;
 
 import '../base/common.dart';
+import '../base/file_system.dart';
 import '../base/logger.dart';
 import '../base/process.dart';
 import '../cache.dart';
@@ -21,7 +21,8 @@
   if (pubSpecYaml.lastModifiedSync().isAfter(dotPackagesLastModified))
     return true;
   File flutterToolsStamp = Cache.instance.getStampFileFor('flutter_tools');
-  if (flutterToolsStamp.lastModifiedSync().isAfter(dotPackagesLastModified))
+  if (flutterToolsStamp.existsSync() &&
+      flutterToolsStamp.lastModifiedSync().isAfter(dotPackagesLastModified))
     return true;
   return false;
 }
@@ -33,10 +34,10 @@
   bool checkLastModified: true
 }) async {
   if (directory == null)
-    directory = Directory.current.path;
+    directory = fs.currentDirectory.path;
 
-  File pubSpecYaml = new File(path.join(directory, 'pubspec.yaml'));
-  File dotPackages = new File(path.join(directory, '.packages'));
+  File pubSpecYaml = fs.file(path.join(directory, 'pubspec.yaml'));
+  File dotPackages = fs.file(path.join(directory, '.packages'));
 
   if (!pubSpecYaml.existsSync()) {
     if (!skipIfAbsent)
diff --git a/packages/flutter_tools/lib/src/dependency_checker.dart b/packages/flutter_tools/lib/src/dependency_checker.dart
index 88deffd..e407c09 100644
--- a/packages/flutter_tools/lib/src/dependency_checker.dart
+++ b/packages/flutter_tools/lib/src/dependency_checker.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 'globals.dart';
 
+import 'base/file_system.dart';
 import 'dart/dependencies.dart';
 import 'dart/package_map.dart';
 import 'asset.dart';
@@ -51,7 +50,7 @@
 
     // Check all dependency modification times.
     for (String path in _dependencies) {
-      File file = new File(path);
+      File file = fs.file(path);
       FileStat stat = file.statSync();
       if (stat.type == FileSystemEntityType.NOT_FOUND) {
         printTrace('DependencyChecker: Error stating $path.');
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index 304e12c..9ee5834 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -4,11 +4,12 @@
 
 import 'dart:async';
 import 'dart:convert' show BASE64, UTF8;
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:path/path.dart' as path;
 
 import 'base/context.dart';
+import 'base/file_system.dart';
 import 'build_info.dart';
 import 'dart/package_map.dart';
 import 'asset.dart';
@@ -89,7 +90,7 @@
     if (_fileStat.type == FileSystemEntityType.LINK) {
       // Resolve, stat, and maybe cache the symlink target.
       String resolved = file.resolveSymbolicLinksSync();
-      FileSystemEntity linkTarget = new File(resolved);
+      FileSystemEntity linkTarget = fs.file(resolved);
       // Stat the link target.
       _fileStat = linkTarget.statSync();
       if (devFSConfig.cacheSymlinks) {
@@ -104,7 +105,7 @@
     }
     if (file is Link) {
       // The link target.
-      return new File(file.resolveSymbolicLinksSync());
+      return fs.file(file.resolveSymbolicLinksSync());
     }
     return file;
   }
@@ -126,7 +127,7 @@
   }
 
   Stream<List<int>> contentsAsCompressedStream() {
-    return contentsAsStream().transform(GZIP.encoder);
+    return contentsAsStream().transform(io.GZIP.encoder);
   }
 }
 
@@ -213,13 +214,13 @@
   int _inFlight = 0;
   List<DevFSEntry> _outstanding;
   Completer<Null> _completer;
-  HttpClient _client;
+  io.HttpClient _client;
   int _done;
   int _max;
 
   Future<Null> write(Set<DevFSEntry> entries,
                      {DevFSProgressReporter progressReporter}) async {
-    _client = new HttpClient();
+    _client = new io.HttpClient();
     _client.maxConnectionsPerHost = kMaxInFlight;
     _completer = new Completer<Null>();
     _outstanding = entries.toList();
@@ -245,14 +246,14 @@
   Future<Null> _scheduleWrite(DevFSEntry entry,
                               DevFSProgressReporter progressReporter) async {
     try {
-      HttpClientRequest request = await _client.putUrl(httpAddress);
-      request.headers.removeAll(HttpHeaders.ACCEPT_ENCODING);
+      io.HttpClientRequest request = await _client.putUrl(httpAddress);
+      request.headers.removeAll(io.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);
-      HttpClientResponse response = await request.close();
+      io.HttpClientResponse response = await request.close();
       await response.drain();
     } catch (e, stackTrace) {
       printError('Error writing "${entry.devicePath}" to DevFS: $e\n$stackTrace');
@@ -353,7 +354,7 @@
     printTrace('Scanning package files');
 
     StringBuffer sb;
-    if (FileSystemEntity.isFileSync(_packagesFilePath)) {
+    if (fs.isFileSync(_packagesFilePath)) {
       PackageMap packageMap = new PackageMap(_packagesFilePath);
 
       for (String packageName in packageMap.map.keys) {
@@ -368,7 +369,7 @@
         // path imports within the project's own code.
         final String packagesDirectoryName =
             isProjectPackage ? 'packages/$packageName' : null;
-        Directory directory = new Directory.fromUri(uri);
+        Directory directory = fs.directory(uri);
         bool packageExists =
             await _scanDirectory(directory,
                                  directoryName: directoryName,
@@ -527,7 +528,7 @@
           // Check if this is a symlink to a directory and skip it.
           final String linkPath = file.resolveSymbolicLinksSync();
           final FileSystemEntityType linkType =
-              FileStat.statSync(linkPath).type;
+              fs.statSync(linkPath).type;
           if (linkType == FileSystemEntityType.DIRECTORY) {
             continue;
           }
diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart
index 75e4b6c..6048d62 100644
--- a/packages/flutter_tools/lib/src/device.dart
+++ b/packages/flutter_tools/lib/src/device.dart
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 import 'dart:math' as math;
 
 import 'android/android_device.dart';
 import 'application_package.dart';
 import 'base/common.dart';
 import 'base/context.dart';
+import 'base/file_system.dart';
 import 'base/os.dart';
 import 'base/utils.dart';
 import 'build_info.dart';
diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart
index 2b4f96f..d6ad8ec 100644
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -3,7 +3,7 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:archive/archive.dart';
 import 'dart:convert' show UTF8;
@@ -12,6 +12,7 @@
 import 'android/android_workflow.dart';
 import 'base/common.dart';
 import 'base/context.dart';
+import 'base/file_system.dart';
 import 'device.dart';
 import 'globals.dart';
 import 'ios/ios_workflow.dart';
@@ -26,7 +27,7 @@
 };
 
 String osName() {
-  String os = Platform.operatingSystem;
+  String os = io.Platform.operatingSystem;
   return _osNames.containsKey(os) ? _osNames[os] : os;
 }
 
@@ -123,7 +124,7 @@
       else
         printStatus('${result.leadingBox} ${validator.title}');
 
-      final String separator = Platform.isWindows ? ' ' : '•';
+      final String separator = io.Platform.isWindows ? ' ' : '•';
 
       for (ValidationMessage message in result.messages) {
         String text = message.message.replaceAll('\n', '\n      ');
@@ -181,7 +182,7 @@
     if (type == ValidationType.missing)
       return '[x]';
     else if (type == ValidationType.installed)
-      return Platform.isWindows ? '[+]' : '[✓]';
+      return io.Platform.isWindows ? '[+]' : '[✓]';
     else
       return '[-]';
   }
@@ -216,7 +217,7 @@
     messages.add(new ValidationMessage('Engine revision ${version.engineRevisionShort}'));
     messages.add(new ValidationMessage('Tools Dart version ${version.dartSdkVersion}'));
 
-    if (Platform.isWindows) {
+    if (io.Platform.isWindows) {
       valid = ValidationType.missing;
 
       messages.add(new ValidationMessage.error(
@@ -253,9 +254,9 @@
   };
 
   static Iterable<DoctorValidator> get installedValidators {
-    if (Platform.isLinux)
+    if (io.Platform.isLinux)
       return IntelliJValidatorOnLinux.installed;
-    if (Platform.isMacOS)
+    if (io.Platform.isMacOS)
       return IntelliJValidatorOnMac.installed;
     // TODO(danrubel): add support for Windows
     return <DoctorValidator>[];
@@ -307,7 +308,7 @@
     // TODO(danrubel) look for a better way to extract a single 2K file from the zip
     // rather than reading the entire file into memory.
     try {
-      Archive archive = new ZipDecoder().decodeBytes(new File(jarPath).readAsBytesSync());
+      Archive archive = new ZipDecoder().decodeBytes(fs.file(jarPath).readAsBytesSync());
       ArchiveFile file = archive.findFile('META-INF/plugin.xml');
       String content = UTF8.decode(file.content);
       String versionStartTag = '<version>';
@@ -322,8 +323,8 @@
   bool hasPackage(String packageName) {
     String packagePath = path.join(pluginsPath, packageName);
     if (packageName.endsWith('.jar'))
-      return FileSystemEntity.isFileSync(packagePath);
-    return FileSystemEntity.isDirectorySync(packagePath);
+      return fs.isFileSync(packagePath);
+    return fs.isDirectorySync(packagePath);
   }
 }
 
@@ -356,7 +357,7 @@
       validators.add(validator);
     }
 
-    for (FileSystemEntity dir in new Directory(homeDirPath).listSync()) {
+    for (FileSystemEntity dir in fs.directory(homeDirPath).listSync()) {
       if (dir is Directory) {
         String name = path.basename(dir.path);
         IntelliJValidator._idToTitle.forEach((String id, String title) {
@@ -364,11 +365,11 @@
             String version = name.substring(id.length + 1);
             String installPath;
             try {
-              installPath = new File(path.join(dir.path, 'system', '.home')).readAsStringSync();
+              installPath = fs.file(path.join(dir.path, 'system', '.home')).readAsStringSync();
             } catch (e) {
               // ignored
             }
-            if (installPath != null && FileSystemEntity.isDirectorySync(installPath)) {
+            if (installPath != null && fs.isDirectorySync(installPath)) {
               String pluginsPath = path.join(dir.path, 'config', 'plugins');
               addValidator(title, version, installPath, pluginsPath);
             }
@@ -405,7 +406,7 @@
     }
 
     try {
-      for (FileSystemEntity dir in new Directory('/Applications').listSync()) {
+      for (FileSystemEntity dir in fs.directory('/Applications').listSync()) {
         if (dir is Directory) {
           checkForIntelliJ(dir);
           if (!dir.path.endsWith('.app')) {
@@ -432,7 +433,7 @@
     if (_version == null) {
       String plist;
       try {
-        plist = new File(path.join(installPath, 'Contents', 'Info.plist')).readAsStringSync();
+        plist = fs.file(path.join(installPath, 'Contents', 'Info.plist')).readAsStringSync();
         int index = plist.indexOf('CFBundleShortVersionString');
         if (index > 0) {
           int start = plist.indexOf('<string>', index);
diff --git a/packages/flutter_tools/lib/src/flx.dart b/packages/flutter_tools/lib/src/flx.dart
index 3f11950..d0567dc 100644
--- a/packages/flutter_tools/lib/src/flx.dart
+++ b/packages/flutter_tools/lib/src/flx.dart
@@ -3,13 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:path/path.dart' as path;
 
 import 'asset.dart';
 import 'base/common.dart';
-import 'base/file_system.dart' show ensureDirectoryExists;
+import 'base/file_system.dart';
 import 'base/process.dart';
 import 'dart/package_map.dart';
 import 'build_info.dart';
@@ -107,7 +106,7 @@
     if (result != 0)
       throwToolExit('Failed to run the Flutter compiler. Exit code: $result', exitCode: result);
 
-    snapshotFile = new File(snapshotPath);
+    snapshotFile = fs.file(snapshotPath);
   }
 
   return assemble(
@@ -162,7 +161,7 @@
   ensureDirectoryExists(outputPath);
 
   printTrace('Encoding zip file to $outputPath');
-  zipBuilder.createZip(new File(outputPath), new Directory(workingDirPath));
+  zipBuilder.createZip(fs.file(outputPath), fs.directory(workingDirPath));
 
   printTrace('Built $outputPath.');
 }
diff --git a/packages/flutter_tools/lib/src/hot.dart b/packages/flutter_tools/lib/src/hot.dart
index 0ec3de2..81d06097 100644
--- a/packages/flutter_tools/lib/src/hot.dart
+++ b/packages/flutter_tools/lib/src/hot.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:meta/meta.dart';
 import 'package:path/path.dart' as path;
@@ -12,6 +11,7 @@
 import 'application_package.dart';
 import 'asset.dart';
 import 'base/context.dart';
+import 'base/file_system.dart';
 import 'base/logger.dart';
 import 'base/utils.dart';
 import 'build_info.dart';
@@ -51,7 +51,7 @@
              target: target,
              debuggingOptions: debuggingOptions,
              usesTerminalUI: usesTerminalUI) {
-    _projectRootPath = projectRootPath ?? Directory.current.path;
+    _projectRootPath = projectRootPath ?? fs.currentDirectory.path;
     _packagesFilePath =
             packagesFilePath ?? path.absolute(PackageMap.globalPackagesPath);
     if (projectAssets != null)
@@ -136,7 +136,7 @@
     bool shouldBuild: true
   }) async {
     _mainPath = findMainDartFile(target);
-    if (!FileSystemEntity.isFileSync(_mainPath)) {
+    if (!fs.isFileSync(_mainPath)) {
       String message = 'Tried to run $_mainPath, but that file does not exist.';
       if (target == null)
         message += '\nConsider using the -t option to specify the Dart file to start.';
@@ -241,7 +241,7 @@
       await _cleanupDevFS();
       await stopEchoingDeviceLog();
       await stopApp();
-      File benchmarkOutput = new File('hot_benchmark.json');
+      File benchmarkOutput = fs.file('hot_benchmark.json');
       benchmarkOutput.writeAsStringSync(toPrettyJson(benchmarkData));
     }
 
@@ -267,7 +267,7 @@
     String fsName = path.basename(_projectRootPath);
     _devFS = new DevFS(vmService,
                        fsName,
-                       new Directory(_projectRootPath),
+                       fs.directory(_projectRootPath),
                        packagesFilePath: _packagesFilePath);
     return _devFS.create();
   }
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index a297471..0017cbf 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -4,9 +4,10 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+import 'dart:io' as io;
 
 import '../application_package.dart';
+import '../base/file_system.dart';
 import '../base/os.dart';
 import '../base/process.dart';
 import '../base/process_manager.dart';
@@ -27,7 +28,7 @@
   IOSDevices() : super('IOSDevices');
 
   @override
-  bool get supportsPlatform => Platform.isMacOS;
+  bool get supportsPlatform => io.Platform.isMacOS;
 
   @override
   List<Device> pollingGetDevices() => IOSDevice.getAttachedDevices();
@@ -124,7 +125,7 @@
       try {
         command = runCheckedSync(<String>['which', command]).trim();
       } catch (e) {
-        if (Platform.isMacOS) {
+        if (io.Platform.isMacOS) {
           printError('$command not found. $macInstructions');
         } else {
           printError('Cannot control iOS devices or simulators. $command is not available on your platform.');
@@ -150,7 +151,7 @@
   @override
   bool installApp(ApplicationPackage app) {
     IOSApp iosApp = app;
-    Directory bundle = new Directory(iosApp.deviceBundlePath);
+    Directory bundle = fs.directory(iosApp.deviceBundlePath);
     if (!bundle.existsSync()) {
       printError("Could not find application bundle at ${bundle.path}; have you run 'flutter build ios'?");
       return false;
@@ -207,7 +208,7 @@
 
     // Step 2: Check that the application exists at the specified path.
     IOSApp iosApp = app;
-    Directory bundle = new Directory(iosApp.deviceBundlePath);
+    Directory bundle = fs.directory(iosApp.deviceBundlePath);
     if (!bundle.existsSync()) {
       printError('Could not find the built application bundle at ${bundle.path}.');
       return new LaunchResult.failed();
@@ -312,7 +313,7 @@
   }
 
   Future<bool> pushFile(ApplicationPackage app, String localFile, String targetFile) async {
-    if (Platform.isMacOS) {
+    if (io.Platform.isMacOS) {
       runSync(<String>[
         pusherPath,
         '-t',
@@ -391,7 +392,7 @@
   final IOSDevice device;
 
   StreamController<String> _linesController;
-  Process _process;
+  io.Process _process;
 
   @override
   Stream<String> get logLines => _linesController.stream;
@@ -400,7 +401,7 @@
   String get name => device.name;
 
   void _start() {
-    runCommand(<String>[device.loggerPath]).then((Process process) {
+    runCommand(<String>[device.loggerPath]).then((io.Process process) {
       _process = process;
       _process.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
       _process.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
@@ -444,7 +445,7 @@
     }
 
     // Usage: iproxy LOCAL_TCP_PORT DEVICE_TCP_PORT UDID
-    Process process = await runCommand(<String>[
+    io.Process process = await runCommand(<String>[
       device.iproxyPath,
       hostPort.toString(),
       devicePort.toString(),
@@ -470,7 +471,7 @@
 
     printTrace("Unforwarding port $forwardedPort");
 
-    Process process = forwardedPort.context;
+    io.Process process = forwardedPort.context;
 
     if (process != null) {
       processManager.killPid(process.pid);
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index b7eead4..cf1d317 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -4,12 +4,13 @@
 
 import 'dart:async';
 import 'dart:convert' show JSON;
-import 'dart:io';
+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/process.dart';
 import '../base/process_manager.dart';
 import '../build_info.dart';
@@ -40,7 +41,7 @@
       } else {
         try {
           printTrace('xcrun clang');
-          ProcessResult result = processManager.runSync('/usr/bin/xcrun', <String>['clang']);
+          io.ProcessResult result = processManager.runSync('/usr/bin/xcrun', <String>['clang']);
 
           if (result.stdout != null && result.stdout.contains('license'))
             _eulaSigned = false;
@@ -107,7 +108,7 @@
   bool buildForDevice,
   bool codesign: true
 }) async {
-  String flutterProjectPath = Directory.current.path;
+  String flutterProjectPath = fs.currentDirectory.path;
   updateXcodeGeneratedProperties(flutterProjectPath, mode, target);
 
   if (!_checkXcodeVersion())
@@ -116,7 +117,7 @@
   // Before the build, all service definitions must be updated and the dylibs
   // copied over to a location that is suitable for Xcodebuild to find them.
 
-  await _addServicesToBundle(new Directory(app.appDirectory));
+  await _addServicesToBundle(fs.directory(app.appDirectory));
 
   List<String> commands = <String>[
     '/usr/bin/env',
@@ -128,7 +129,7 @@
     'ONLY_ACTIVE_ARCH=YES',
   ];
 
-  List<FileSystemEntity> contents = new Directory(app.appDirectory).listSync();
+  List<FileSystemEntity> contents = fs.directory(app.appDirectory).listSync();
   for (FileSystemEntity entity in contents) {
     if (path.extension(entity.path) == '.xcworkspace') {
       commands.addAll(<String>[
@@ -180,7 +181,7 @@
 }
 
 void diagnoseXcodeBuildFailure(XcodeBuildResult result) {
-  File plistFile = new File('ios/Runner/Info.plist');
+  File plistFile = fs.file('ios/Runner/Info.plist');
   if (plistFile.existsSync()) {
     String plistContent = plistFile.readAsStringSync();
     if (plistContent.contains('com.yourcompany')) {
@@ -219,7 +220,7 @@
 final String _xcodeRequirement = 'Xcode 7.0 or greater is required to develop for iOS.';
 
 bool _checkXcodeVersion() {
-  if (!Platform.isMacOS)
+  if (!io.Platform.isMacOS)
     return false;
   try {
     String version = runCheckedSync(<String>['xcodebuild', '-version']);
@@ -245,12 +246,12 @@
   printTrace("Found ${services.length} service definition(s).");
 
   // Step 2: Copy framework dylibs to the correct spot for xcodebuild to pick up.
-  Directory frameworksDirectory = new Directory(path.join(bundle.path, "Frameworks"));
+  Directory frameworksDirectory = fs.directory(path.join(bundle.path, "Frameworks"));
   await _copyServiceFrameworks(services, frameworksDirectory);
 
   // Step 3: Copy the service definitions manifest at the correct spot for
   //         xcodebuild to pick up.
-  File manifestFile = new File(path.join(bundle.path, "ServiceDefinitions.json"));
+  File manifestFile = fs.file(path.join(bundle.path, "ServiceDefinitions.json"));
   _copyServiceDefinitionsManifest(services, manifestFile);
 }
 
@@ -259,7 +260,7 @@
   frameworksDirectory.createSync(recursive: true);
   for (Map<String, String> service in services) {
     String dylibPath = await getServiceFromUrl(service['ios-framework'], service['root'], service['name']);
-    File dylib = new File(dylibPath);
+    File dylib = fs.file(dylibPath);
     printTrace("Copying ${dylib.path} into bundle.");
     if (!dylib.existsSync()) {
       printError("The service dylib '${dylib.path}' does not exist.");
diff --git a/packages/flutter_tools/lib/src/ios/plist_utils.dart b/packages/flutter_tools/lib/src/ios/plist_utils.dart
index 3b36af4..bee1b23 100644
--- a/packages/flutter_tools/lib/src/ios/plist_utils.dart
+++ b/packages/flutter_tools/lib/src/ios/plist_utils.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/file_system.dart';
 import '../base/process.dart';
 
 const String kCFBundleIdentifierKey = "CFBundleIdentifier";
@@ -18,7 +17,7 @@
   // 'defaults' requires the path to be absolute and without the 'plist'
   // extension.
 
-  if (!FileSystemEntity.isFileSync(plistFilePath))
+  if (!fs.isFileSync(plistFilePath))
     return null;
 
   String normalizedPlistPath = path.withoutExtension(path.absolute(plistFilePath));
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index fc91b9c..597ca42 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -4,7 +4,7 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+import 'dart:io' as io;
 import 'dart:math' as math;
 
 import 'package:path/path.dart' as path;
@@ -12,6 +12,7 @@
 import '../application_package.dart';
 import '../base/common.dart';
 import '../base/context.dart';
+import '../base/file_system.dart';
 import '../base/process.dart';
 import '../base/process_manager.dart';
 import '../build_info.dart';
@@ -30,7 +31,7 @@
   IOSSimulators() : super('IOSSimulators');
 
   @override
-  bool get supportsPlatform => Platform.isMacOS;
+  bool get supportsPlatform => io.Platform.isMacOS;
 
   @override
   List<Device> pollingGetDevices() => IOSSimulatorUtils.instance.getAttachedDevices();
@@ -191,7 +192,7 @@
 
     List<String> args = <String>['simctl', 'list', '--json', section.name];
     printTrace('$_xcrunPath ${args.join(' ')}');
-    ProcessResult results = processManager.runSync(_xcrunPath, args);
+    io.ProcessResult results = processManager.runSync(_xcrunPath, args);
     if (results.exitCode != 0) {
       printError('Error executing simctl: ${results.exitCode}\n${results.stderr}');
       return <String, Map<String, dynamic>>{};
@@ -358,7 +359,7 @@
 
   @override
   bool isSupported() {
-    if (!Platform.isMacOS) {
+    if (!io.Platform.isMacOS) {
       _supportMessage = "Not supported on a non Mac host";
       return false;
     }
@@ -510,7 +511,7 @@
 
     // Step 2: Assert that the Xcode project was successfully built.
     IOSApp iosApp = app;
-    Directory bundle = new Directory(iosApp.simulatorBundlePath);
+    Directory bundle = fs.directory(iosApp.simulatorBundlePath);
     bool bundleExists = bundle.existsSync();
     if (!bundleExists)
       throwToolExit('Could not find the built application bundle at ${bundle.path}.');
@@ -530,7 +531,7 @@
 
   Future<bool> pushFile(
       ApplicationPackage app, String localFile, String targetFile) async {
-    if (Platform.isMacOS) {
+    if (io.Platform.isMacOS) {
       String simulatorHomeDirectory = _getSimulatorAppHomeDirectory(app);
       runCheckedSync(<String>['cp', localFile, path.join(simulatorHomeDirectory, targetFile)]);
       return true;
@@ -564,7 +565,7 @@
 
   @override
   void clearLogs() {
-    File logFile = new File(logFilePath);
+    File logFile = fs.file(logFilePath);
     if (logFile.existsSync()) {
       RandomAccessFile randomFile = logFile.openSync(mode: FileMode.WRITE);
       randomFile.truncateSync(0);
@@ -573,7 +574,7 @@
   }
 
   void ensureLogsExists() {
-    File logFile = new File(logFilePath);
+    File logFile = fs.file(logFilePath);
     if (!logFile.existsSync())
       logFile.writeAsBytesSync(<int>[]);
   }
@@ -583,7 +584,7 @@
 
   @override
   Future<bool> takeScreenshot(File outputFile) async {
-    Directory desktopDir = new Directory(path.join(homeDirPath, 'Desktop'));
+    Directory desktopDir = fs.directory(path.join(homeDirPath, 'Desktop'));
 
     // 'Simulator Screen Shot Mar 25, 2016, 2.59.43 PM.png'
 
@@ -639,8 +640,8 @@
   StreamController<String> _linesController;
 
   // We log from two files: the device and the system log.
-  Process _deviceProcess;
-  Process _systemProcess;
+  io.Process _deviceProcess;
+  io.Process _systemProcess;
 
   @override
   Stream<String> get logLines => _linesController.stream;
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
index 6d1bc49..3d440e1 100644
--- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart
+++ b/packages/flutter_tools/lib/src/ios/xcodeproj.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/file_system.dart';
 import '../base/process.dart';
 import '../build_info.dart';
 import '../cache.dart';
@@ -23,7 +22,7 @@
   localsBuffer.writeln('FLUTTER_ROOT=$flutterRoot');
 
   // This holds because requiresProjectRoot is true for this command
-  String applicationRoot = path.normalize(Directory.current.path);
+  String applicationRoot = path.normalize(fs.currentDirectory.path);
   localsBuffer.writeln('FLUTTER_APPLICATION_PATH=$applicationRoot');
 
   // Relative to FLUTTER_APPLICATION_PATH, which is [Directory.current].
@@ -43,7 +42,7 @@
   if (tools.isLocalEngine)
     localsBuffer.writeln('LOCAL_ENGINE=${tools.engineBuildPath}');
 
-  File localsFile = new File(path.join(projectPath, 'ios', 'Flutter', 'Generated.xcconfig'));
+  File localsFile = fs.file(path.join(projectPath, 'ios', 'Flutter', 'Generated.xcconfig'));
   localsFile.createSync(recursive: true);
   localsFile.writeAsStringSync(localsBuffer.toString());
 }
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index 1492d81..d049556 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -3,12 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+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/logger.dart';
 import 'build_info.dart';
 import 'device.dart';
@@ -77,12 +78,12 @@
   }
 
   void registerSignalHandlers() {
-    ProcessSignal.SIGINT.watch().listen((ProcessSignal signal) async {
+    io.ProcessSignal.SIGINT.watch().listen((io.ProcessSignal signal) async {
       _resetTerminal();
       await cleanupAfterSignal();
       exit(0);
     });
-    ProcessSignal.SIGTERM.watch().listen((ProcessSignal signal) async {
+    io.ProcessSignal.SIGTERM.watch().listen((io.ProcessSignal signal) async {
       _resetTerminal();
       await cleanupAfterSignal();
       exit(0);
@@ -91,19 +92,19 @@
       return;
     if (!supportsRestart)
       return;
-    ProcessSignal.SIGUSR1.watch().listen(_handleSignal);
-    ProcessSignal.SIGUSR2.watch().listen(_handleSignal);
+    io.ProcessSignal.SIGUSR1.watch().listen(_handleSignal);
+    io.ProcessSignal.SIGUSR2.watch().listen(_handleSignal);
   }
 
   bool _processingSignal = false;
-  Future<Null> _handleSignal(ProcessSignal signal) async {
+  Future<Null> _handleSignal(io.ProcessSignal signal) async {
     if (_processingSignal) {
       printTrace('Ignoring signal: "$signal" because we are busy.');
       return;
     }
     _processingSignal = true;
 
-    final bool fullRestart = signal == ProcessSignal.SIGUSR2;
+    final bool fullRestart = signal == io.ProcessSignal.SIGUSR2;
 
     try {
       await restart(fullRestart: fullRestart);
@@ -279,7 +280,7 @@
   if (target == null)
     target = '';
   String targetPath = path.absolute(target);
-  if (FileSystemEntity.isDirectorySync(targetPath))
+  if (fs.isDirectorySync(targetPath))
     return path.join(targetPath, 'lib', 'main.dart');
   else
     return targetPath;
diff --git a/packages/flutter_tools/lib/src/run.dart b/packages/flutter_tools/lib/src/run.dart
index b8a6562..4465f21 100644
--- a/packages/flutter_tools/lib/src/run.dart
+++ b/packages/flutter_tools/lib/src/run.dart
@@ -3,12 +3,12 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:meta/meta.dart';
 import 'package:stack_trace/stack_trace.dart';
 
 import 'application_package.dart';
+import 'base/file_system.dart';
 import 'base/utils.dart';
 import 'build_info.dart';
 import 'commands/trace.dart';
@@ -68,7 +68,7 @@
   }) async {
     if (!prebuiltMode) {
       _mainPath = findMainDartFile(target);
-      if (!FileSystemEntity.isFileSync(_mainPath)) {
+      if (!fs.isFileSync(_mainPath)) {
         String message = 'Tried to run $_mainPath, but that file does not exist.';
         if (target == null)
           message += '\nConsider using the -t option to specify the Dart file to start.';
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index 747bb1e..37c5eeb 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
 
 import 'package:args/command_runner.dart';
 import 'package:meta/meta.dart';
 
 import '../application_package.dart';
 import '../base/common.dart';
+import '../base/file_system.dart';
 import '../build_info.dart';
 import '../dart/package_map.dart';
 import '../dart/pub.dart';
@@ -207,7 +207,7 @@
   void commonCommandValidator() {
     if (!PackageMap.isUsingCustomPackagesPath) {
       // Don't expect a pubspec.yaml file if the user passed in an explicit .packages file path.
-      if (!FileSystemEntity.isFileSync('pubspec.yaml')) {
+      if (!fs.isFileSync('pubspec.yaml')) {
         throw new ToolExit('Error: No pubspec.yaml file found.\n'
           'This command should be run from the root of your Flutter project.\n'
           'Do not run this command from the root of your git clone of Flutter.');
@@ -216,7 +216,7 @@
 
     if (_usesTargetOption) {
       String targetPath = targetFile;
-      if (!FileSystemEntity.isFileSync(targetPath))
+      if (!fs.isFileSync(targetPath))
         throw new ToolExit('Target file "$targetPath" not found.');
     }
 
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 104cdbf..4d2078e 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,7 @@
 // found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:io';
+import 'dart:io' as io;
 
 import 'package:args/args.dart';
 import 'package:args/command_runner.dart';
@@ -12,6 +12,7 @@
 import '../android/android_sdk.dart';
 import '../base/common.dart';
 import '../base/context.dart';
+import '../base/file_system.dart';
 import '../base/logger.dart';
 import '../base/process.dart';
 import '../base/process_manager.dart';
@@ -67,7 +68,7 @@
         help: 'Suppress analytics reporting when this command runs.');
 
     String packagesHelp;
-    if (FileSystemEntity.isFileSync(kPackagesFileName))
+    if (fs.isFileSync(kPackagesFileName))
       packagesHelp = '\n(defaults to "$kPackagesFileName")';
     else
       packagesHelp = '\n(required, since the current directory does not contain a "$kPackagesFileName" file)';
@@ -117,12 +118,12 @@
   }
 
   static String get _defaultFlutterRoot {
-    if (Platform.environment.containsKey(kFlutterRootEnvironmentVariableName))
-      return Platform.environment[kFlutterRootEnvironmentVariableName];
+    if (io.Platform.environment.containsKey(kFlutterRootEnvironmentVariableName))
+      return io.Platform.environment[kFlutterRootEnvironmentVariableName];
     try {
-      if (Platform.script.scheme == 'data')
+      if (io.Platform.script.scheme == 'data')
         return '../..'; // we're running as a test
-      String script = Platform.script.toFilePath();
+      String script = io.Platform.script.toFilePath();
       if (path.basename(script) == kSnapshotFileName)
         return path.dirname(path.dirname(path.dirname(script)));
       if (path.basename(script) == kFlutterToolsScriptFileName)
@@ -191,7 +192,7 @@
     // enginePath's initialiser uses it).
     Cache.flutterRoot = path.normalize(path.absolute(globalResults['flutter-root']));
 
-    if (Platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true')
+    if (io.Platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true')
       await Cache.lock();
 
     if (globalResults['suppress-analytics'])
@@ -225,20 +226,20 @@
   }
 
   String _tryEnginePath(String enginePath) {
-    if (FileSystemEntity.isDirectorySync(path.join(enginePath, 'out')))
+    if (fs.isDirectorySync(path.join(enginePath, 'out')))
       return enginePath;
     return null;
   }
 
   String _findEnginePath(ArgResults globalResults) {
-    String engineSourcePath = globalResults['local-engine-src-path'] ?? Platform.environment[kFlutterEngineEnvironmentVariableName];
+    String engineSourcePath = globalResults['local-engine-src-path'] ?? io.Platform.environment[kFlutterEngineEnvironmentVariableName];
 
     if (engineSourcePath == null && globalResults['local-engine'] != null) {
       try {
         Uri engineUri = new PackageMap(PackageMap.globalPackagesPath).map[kFlutterEnginePackageName];
         if (engineUri != null) {
           engineSourcePath = path.dirname(path.dirname(path.dirname(path.dirname(engineUri.path))));
-          bool dirExists = FileSystemEntity.isDirectorySync(path.join(engineSourcePath, 'out'));
+          bool dirExists = fs.isDirectorySync(path.join(engineSourcePath, 'out'));
           if (engineSourcePath == '/' || engineSourcePath.isEmpty || !dirExists)
             engineSourcePath = null;
         }
@@ -276,7 +277,7 @@
     }
 
     String engineBuildPath = path.normalize(path.join(enginePath, 'out', localEngine));
-    if (!FileSystemEntity.isDirectorySync(engineBuildPath)) {
+    if (!fs.isDirectorySync(engineBuildPath)) {
       printError('No Flutter engine build found at $engineBuildPath.');
       throw new ProcessExit(2);
     }
@@ -292,18 +293,18 @@
   /// Get all pub packages in the Flutter repo.
   List<Directory> getRepoPackages() {
     return _gatherProjectPaths(path.absolute(Cache.flutterRoot))
-      .map((String dir) => new Directory(dir))
+      .map((String dir) => fs.directory(dir))
       .toList();
   }
 
   static List<String> _gatherProjectPaths(String rootPath) {
-    if (FileSystemEntity.isFileSync(path.join(rootPath, '.dartignore')))
+    if (fs.isFileSync(path.join(rootPath, '.dartignore')))
       return <String>[];
 
-    if (FileSystemEntity.isFileSync(path.join(rootPath, 'pubspec.yaml')))
+    if (fs.isFileSync(path.join(rootPath, 'pubspec.yaml')))
       return <String>[rootPath];
 
-    return new Directory(rootPath)
+    return fs.directory(rootPath)
       .listSync(followLinks: false)
       .expand((FileSystemEntity entity) {
         return entity is Directory ? _gatherProjectPaths(entity.path) : <String>[];
@@ -316,13 +317,13 @@
     final String rootPath = path.absolute(Cache.flutterRoot);
     final List<Directory> result = <Directory>[
       // not bin, and not the root
-      new Directory(path.join(rootPath, 'dev')),
-      new Directory(path.join(rootPath, 'examples')),
+      fs.directory(path.join(rootPath, 'dev')),
+      fs.directory(path.join(rootPath, 'examples')),
     ];
     // And since analyzer refuses to look at paths that end in "packages/":
     result.addAll(
       _gatherProjectPaths(path.join(rootPath, 'packages'))
-      .map/*<Directory>*/((String path) => new Directory(path))
+      .map/*<Directory>*/((String path) => fs.directory(path))
     );
     return result;
   }
@@ -330,7 +331,7 @@
   void _checkFlutterCopy() {
     // If the current directory is contained by a flutter repo, check that it's
     // the same flutter that is currently running.
-    String directory = path.normalize(path.absolute(Directory.current.path));
+    String directory = path.normalize(path.absolute(fs.currentDirectory.path));
 
     // Check if the cwd is a flutter dir.
     while (directory.isNotEmpty) {
@@ -355,14 +356,14 @@
     }
 
     // Check that the flutter running is that same as the one referenced in the pubspec.
-    if (FileSystemEntity.isFileSync(kPackagesFileName)) {
+    if (fs.isFileSync(kPackagesFileName)) {
       PackageMap packageMap = new PackageMap(kPackagesFileName);
       Uri flutterUri = packageMap.map['flutter'];
 
       if (flutterUri != null && (flutterUri.scheme == 'file' || flutterUri.scheme == '')) {
         // .../flutter/packages/flutter/lib
         Uri rootUri = flutterUri.resolve('../../..');
-        String flutterPath = path.normalize(new File.fromUri(rootUri).absolute.path);
+        String flutterPath = path.normalize(fs.file(rootUri).absolute.path);
 
         if (!_compareResolvedPaths(flutterPath, Cache.flutterRoot)) {
           printError(
@@ -381,14 +382,14 @@
   // Check if `bin/flutter` and `bin/cache/engine.stamp` exist.
   bool _isDirectoryFlutterRepo(String directory) {
     return
-      FileSystemEntity.isFileSync(path.join(directory, 'bin/flutter')) &&
-      FileSystemEntity.isFileSync(path.join(directory, 'bin/cache/engine.stamp'));
+      fs.isFileSync(path.join(directory, 'bin/flutter')) &&
+      fs.isFileSync(path.join(directory, 'bin/cache/engine.stamp'));
   }
 }
 
 bool _compareResolvedPaths(String path1, String path2) {
-  path1 = new Directory(path.absolute(path1)).resolveSymbolicLinksSync();
-  path2 = new Directory(path.absolute(path2)).resolveSymbolicLinksSync();
+  path1 = fs.directory(path.absolute(path1)).resolveSymbolicLinksSync();
+  path2 = fs.directory(path.absolute(path2)).resolveSymbolicLinksSync();
 
   return path1 == path2;
 }
diff --git a/packages/flutter_tools/lib/src/services.dart b/packages/flutter_tools/lib/src/services.dart
index 824dd14..fe20846 100644
--- a/packages/flutter_tools/lib/src/services.dart
+++ b/packages/flutter_tools/lib/src/services.dart
@@ -4,11 +4,11 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
 
 import 'package:path/path.dart' as path;
 import 'package:yaml/yaml.dart';
 
+import 'base/file_system.dart';
 import 'dart/package_map.dart';
 import 'android/android_sdk.dart';
 import 'globals.dart';
@@ -18,9 +18,9 @@
 
 dynamic _loadYamlFile(String path) {
   printTrace("Looking for YAML at '$path'");
-  if (!FileSystemEntity.isFileSync(path))
+  if (!fs.isFileSync(path))
     return null;
-  String manifestString = new File(path).readAsStringSync();
+  String manifestString = fs.file(path).readAsStringSync();
   return loadYaml(manifestString);
 }
 
@@ -69,7 +69,7 @@
 
     if (jars != null && serviceConfig['jars'] is Iterable) {
       for (String jar in serviceConfig['jars'])
-        jars.add(new File(await getServiceFromUrl(jar, serviceRoot, service, unzip: false)));
+        jars.add(fs.file(await getServiceFromUrl(jar, serviceRoot, service, unzip: false)));
     }
   }
 }
@@ -106,7 +106,7 @@
       }).toList();
 
   Map<String, dynamic> json = <String, dynamic>{ 'services': services };
-  File servicesFile = new File(path.join(dir, 'services.json'));
+  File servicesFile = fs.file(path.join(dir, 'services.json'));
   servicesFile.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true);
   return servicesFile;
 }
diff --git a/packages/flutter_tools/lib/src/template.dart b/packages/flutter_tools/lib/src/template.dart
index 60fcccc..fc164a2 100644
--- a/packages/flutter_tools/lib/src/template.dart
+++ b/packages/flutter_tools/lib/src/template.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:mustache/mustache.dart' as mustache;
 import 'package:path/path.dart' as path;
 
+import 'base/file_system.dart';
 import 'cache.dart';
 import 'globals.dart';
 
@@ -78,7 +77,7 @@
           .replaceAll(_kTemplateExtension, '');
       if (projectName != null)
         finalDestinationPath = finalDestinationPath.replaceAll('projectName', projectName);
-      File finalDestinationFile = new File(finalDestinationPath);
+      File finalDestinationFile = fs.file(finalDestinationPath);
       String relativePathForLogging = path.relative(finalDestinationFile.path);
 
       // Step 1: Check if the file needs to be overwritten.
@@ -99,7 +98,7 @@
       fileCount++;
 
       finalDestinationFile.createSync(recursive: true);
-      File sourceFile = new File(absoluteSrcPath);
+      File sourceFile = fs.file(absoluteSrcPath);
 
       // Step 2: If the absolute paths ends with a 'copy.tmpl', this file does
       //         not need mustache rendering but needs to be directly copied.
@@ -135,5 +134,5 @@
 Directory _templateDirectoryInPackage(String name) {
   String templatesDir = path.join(Cache.flutterRoot,
       'packages', 'flutter_tools', 'templates');
-  return new Directory(path.join(templatesDir, name));
+  return fs.directory(path.join(templatesDir, name));
 }
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index 9d1e629..67d6d37 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -4,7 +4,7 @@
 
 import 'dart:async';
 import 'dart:convert';
-import 'dart:io';
+import 'dart:io' as io;
 import 'dart:math' as math;
 
 import 'package:path/path.dart' as path;
@@ -14,13 +14,14 @@
 import 'package:test/src/runner/plugin/platform.dart'; // ignore: implementation_imports
 import 'package:test/src/runner/plugin/hack_register_platform.dart' as hack; // ignore: implementation_imports
 
+import '../base/file_system.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 InternetAddress _kHost = InternetAddress.LOOPBACK_IP_V4;
+final io.InternetAddress _kHost = io.InternetAddress.LOOPBACK_IP_V4;
 
 void installHook({ String shellPath }) {
   hack.registerPlatformPlugin(<TestPlatform>[TestPlatform.vm], () => new FlutterPlatform(shellPath: shellPath));
@@ -61,19 +62,19 @@
       controller.sink.done.then((_) { controllerSinkClosed = true; });
 
       // Prepare our WebSocket server to talk to the engine subproces.
-      HttpServer server = await HttpServer.bind(_kHost, 0);
+      io.HttpServer server = await io.HttpServer.bind(_kHost, 0);
       finalizers.add(() async { await server.close(force: true); });
-      Completer<WebSocket> webSocket = new Completer<WebSocket>();
-      server.listen((HttpRequest request) {
-        webSocket.complete(WebSocketTransformer.upgrade(request));
+      Completer<io.WebSocket> webSocket = new Completer<io.WebSocket>();
+      server.listen((io.HttpRequest request) {
+        webSocket.complete(io.WebSocketTransformer.upgrade(request));
       });
 
       // Prepare a temporary directory to store the Dart file that will talk to us.
-      Directory temporaryDirectory = Directory.systemTemp.createTempSync('dart_test_listener');
+      Directory temporaryDirectory = fs.systemTempDirectory.createTempSync('dart_test_listener');
       finalizers.add(() async { temporaryDirectory.deleteSync(recursive: true); });
 
       // Prepare the Dart file that will talk to us and start the test.
-      File listenerFile = new File('${temporaryDirectory.path}/listener.dart');
+      File listenerFile = fs.file('${temporaryDirectory.path}/listener.dart');
       listenerFile.createSync();
       listenerFile.writeAsStringSync(_generateTestMain(
         testUrl: path.toUri(path.absolute(testPath)).toString(),
@@ -90,7 +91,7 @@
       }
 
       // Start the engine subprocess.
-      Process process = await _startProcess(
+      io.Process process = await _startProcess(
         shellPath,
         listenerFile.path,
         packages: PackageMap.globalPackagesPath,
@@ -119,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>((WebSocket webSocket) { return _InitialResult.connected; }),
+        webSocket.future.then<_InitialResult>((io.WebSocket webSocket) { return _InitialResult.connected; }),
       ]);
 
       switch (initialResult) {
@@ -137,7 +138,7 @@
           await controller.sink.done;
           break;
         case _InitialResult.connected:
-          WebSocket testSocket = await webSocket.future;
+          io.WebSocket testSocket = await webSocket.future;
 
           Completer<Null> harnessDone = new Completer<Null>();
           StreamSubscription<dynamic> harnessToTest = controller.stream.listen(
@@ -248,15 +249,15 @@
     sb.writeln('  <cachedir>/var/cache/fontconfig</cachedir>');
     sb.writeln('</fontconfig>');
 
-    Directory fontsDir = Directory.systemTemp.createTempSync('flutter_fonts');
-    _cachedFontConfig = new File('${fontsDir.path}/fonts.conf');
+    Directory fontsDir = fs.systemTempDirectory.createTempSync('flutter_fonts');
+    _cachedFontConfig = fs.file('${fontsDir.path}/fonts.conf');
     _cachedFontConfig.createSync();
     _cachedFontConfig.writeAsStringSync(sb.toString());
     return _cachedFontConfig;
   }
 
 
-  Future<Process> _startProcess(String executable, String testPath, { String packages, int observatoryPort }) {
+  Future<io.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) {
@@ -279,7 +280,7 @@
     return processManager.start(executable, arguments, environment: environment);
   }
 
-  void _pipeStandardStreamsToConsole(Process process) {
+  void _pipeStandardStreamsToConsole(io.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/toolchain.dart b/packages/flutter_tools/lib/src/toolchain.dart
index 3145377..53cb1d0 100644
--- a/packages/flutter_tools/lib/src/toolchain.dart
+++ b/packages/flutter_tools/lib/src/toolchain.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/file_system.dart';
 import 'build_info.dart';
 import 'cache.dart';
 import 'globals.dart';
@@ -50,14 +49,14 @@
 
   Directory _getEngineArtifactsDirectory(TargetPlatform platform, BuildMode mode) {
     if (engineBuildPath != null) {
-      return new Directory(engineBuildPath);
+      return fs.directory(engineBuildPath);
     } else {
       String suffix = mode != BuildMode.debug ? '-${getModeName(mode)}' : '';
 
       // Create something like `android-arm` or `android-arm-release`.
       String dirName = getNameForTargetPlatform(platform) + suffix;
       Directory engineDir = cache.getArtifactDirectory('engine');
-      return new Directory(path.join(engineDir.path, dirName));
+      return fs.directory(path.join(engineDir.path, dirName));
     }
   }
 
@@ -70,7 +69,7 @@
 
     if (tool == HostTool.SkySnapshot) {
       String clangPath = path.join(engineBuildPath, 'clang_x64', 'sky_snapshot');
-      if (FileSystemEntity.isFileSync(clangPath))
+      if (fs.isFileSync(clangPath))
         return clangPath;
       return path.join(engineBuildPath, 'sky_snapshot');
     } else if (tool == HostTool.SkyShell) {
diff --git a/packages/flutter_tools/lib/src/zip.dart b/packages/flutter_tools/lib/src/zip.dart
index d1929cb..332b913 100644
--- a/packages/flutter_tools/lib/src/zip.dart
+++ b/packages/flutter_tools/lib/src/zip.dart
@@ -2,12 +2,11 @@
 // 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:archive/archive.dart';
 import 'package:path/path.dart' as path;
 
 import 'asset.dart';
+import 'base/file_system.dart';
 import 'base/process.dart';
 
 abstract class ZipBuilder {
@@ -66,7 +65,7 @@
 
     for (AssetBundleEntry entry in entries) {
       List<int> data = entry.contentsAsBytes();
-      File file = new File(path.join(zipBuildDir.path, entry.archivePath));
+      File file = fs.file(path.join(zipBuildDir.path, entry.archivePath));
       file.parent.createSync(recursive: true);
       file.writeAsBytesSync(data);
     }