| // Copyright 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| import '../base/common.dart'; |
| import '../base/utils.dart'; |
| import '../globals.dart'; |
| import '../runner/flutter_command.dart'; |
| class DevicesCommand extends FlutterCommand { |
| final String name = 'devices'; |
| final String description = 'List all connected devices.'; |
| Future<Null> runCommand() async { |
| if (!doctor.canListAnything) { |
| "Unable to locate a development device; please run 'flutter doctor' for " |
| "information about installing additional components.", |
| List<Device> devices = await deviceManager.getAllConnectedDevices(); |
| 'No devices detected.\n\n' |
| 'If you expected your device to be detected, please run "flutter doctor" to diagnose\n' |
| 'potential issues, or visit https://flutter.io/setup/ for troubleshooting tips.'); |
| printStatus('${devices.length} connected ${pluralize('device', devices.length)}:\n'); |
| Device.printDevices(devices); |