flutter/packages/flutter_tools/test/general.shard/runner/utils.dart
Jonah Williams 74bd7b6f6d
[flutter_tools] opt all flutter tool libraries and tests out of null safety. (#74832)
* opt out the flutter tool

* oops EOF

* fix import

* Update tool_backend.dart

* Update daemon_client.dart

* fix more
2021-01-27 15:17:53 -08:00

46 lines
1.2 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/reporting/reporting.dart';
import 'package:flutter_tools/src/runner/flutter_command.dart';
import 'package:mockito/mockito.dart';
typedef CommandFunction = Future<FlutterCommandResult> Function();
class DummyFlutterCommand extends FlutterCommand {
DummyFlutterCommand({
this.shouldUpdateCache = false,
this.noUsagePath = false,
this.commandFunction,
});
final bool noUsagePath;
final CommandFunction commandFunction;
@override
final bool shouldUpdateCache;
@override
String get description => 'does nothing';
@override
Future<String> get usagePath => noUsagePath ? null : super.usagePath;
@override
String get name => 'dummy';
@override
Future<FlutterCommandResult> runCommand() async {
return commandFunction == null ? FlutterCommandResult.fail() : await commandFunction();
}
}
class MockitoCache extends Mock implements Cache {}
class MockitoUsage extends Mock implements Usage {}