globals.dart 1.33 KB
Newer Older
1 2 3 4
// Copyright 2016 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.

5 6 7
import 'android/android_sdk.dart';
import 'base/context.dart';
import 'base/logger.dart';
8
import 'cache.dart';
9 10
import 'device.dart';
import 'doctor.dart';
11
import 'toolchain.dart';
12
import 'usage.dart';
13 14 15

DeviceManager get deviceManager => context[DeviceManager];
Logger get logger => context[Logger];
16
AndroidSdk get androidSdk => context[AndroidSdk];
17
Cache get cache => Cache.instance;
18
Doctor get doctor => context[Doctor];
19
ToolConfiguration get tools => ToolConfiguration.instance;
20
Usage get flutterUsage => Usage.instance;
21

22 23 24 25 26 27
/// Display an error level message to the user. Commands should use this if they
/// fail in some way.
void printError(String message, [StackTrace stackTrace]) => logger.printError(message, stackTrace);

/// Display normal output of the command. This should be used for things like
/// progress messages, success messages, or just normal command output.
28
void printStatus(String message, { bool emphasis: false }) => logger.printStatus(message, emphasis: emphasis);
29 30 31 32

/// Use this for verbose tracing output. Users can turn this output on in order
/// to help diagnose issues with the toolchain or with their setup.
void printTrace(String message) => logger.printTrace(message);