
* Remove the workaround that pinned args to v0.13.6 This reverts most of the changes in commit 6331b6c8b5d964ec0dbf2cd9bb84c60c650a0878 * throw exception if exit code is not an integer * rework command infrastructure to throw ToolExit when non-zero exitCode * convert commands to return Future<Null> * cleanup remaining commands to use throwToolExit for non-zero exit code * remove isUnusual exception message * add type annotations for updated args package
44 lines
1.2 KiB
Dart
44 lines
1.2 KiB
Dart
// 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 'dart:async';
|
|
|
|
import '../application_package.dart';
|
|
import '../base/common.dart';
|
|
import '../build_info.dart';
|
|
import '../device.dart';
|
|
import '../globals.dart';
|
|
import '../runner/flutter_command.dart';
|
|
|
|
class StopCommand extends FlutterCommand {
|
|
@override
|
|
final String name = 'stop';
|
|
|
|
@override
|
|
final String description = 'Stop your Flutter app on an attached device.';
|
|
|
|
Device device;
|
|
|
|
@override
|
|
Future<Null> verifyThenRunCommand() async {
|
|
commandValidator();
|
|
device = await findTargetDevice();
|
|
if (device == null)
|
|
throwToolExit(null);
|
|
return super.verifyThenRunCommand();
|
|
}
|
|
|
|
@override
|
|
Future<Null> runCommand() async {
|
|
ApplicationPackage app = applicationPackages.getPackageForPlatform(device.platform);
|
|
if (app == null) {
|
|
String platformName = getNameForTargetPlatform(device.platform);
|
|
throwToolExit('No Flutter application for $platformName found in the current directory.');
|
|
}
|
|
printStatus('Stopping apps on ${device.name}.');
|
|
if (!await device.stopApp(app))
|
|
throwToolExit(null);
|
|
}
|
|
}
|