stop.dart 824 Bytes
Newer Older
1 2 3 4 5 6
// 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';

7 8
import '../application_package.dart';
import '../device.dart';
9
import '../globals.dart';
10
import '../runner/flutter_command.dart';
11

12
class StopCommand extends FlutterCommand {
13
  @override
14
  final String name = 'stop';
15 16

  @override
17 18
  final String description = 'Stop your Flutter app on an attached device.';

19
  @override
20
  bool get requiresDevice => true;
21 22

  @override
23
  Future<int> runInProject() async {
24 25 26 27
    Device device = deviceForCommand;
    ApplicationPackage app = applicationPackages.getPackageForPlatform(device.platform);
    printStatus('Stopping apps on ${device.name}.');
    return await device.stopApp(app) ? 0 : 1;
28 29
  }
}