enable lint prefer_generic_function_type_aliases (#21680)
This commit is contained in:
committed by
GitHub
parent
6c3adcf60f
commit
a07d3719a1
@@ -11,7 +11,7 @@ import 'package:meta/meta.dart';
|
||||
///
|
||||
/// Generators are allowed to return `null`, in which case the context will
|
||||
/// store the `null` value as the value for that type.
|
||||
typedef dynamic Generator();
|
||||
typedef Generator = dynamic Function();
|
||||
|
||||
/// An exception thrown by [AppContext] when you try to get a [Type] value from
|
||||
/// the context, and the instantiation of the value results in a dependency
|
||||
|
||||
@@ -13,7 +13,7 @@ import '../globals.dart';
|
||||
import '../version.dart';
|
||||
import 'file_system.dart';
|
||||
|
||||
typedef bool FingerprintPathFilter(String path);
|
||||
typedef FingerprintPathFilter = bool Function(String path);
|
||||
|
||||
/// A tool that can be used to compute, compare, and write [Fingerprint]s for a
|
||||
/// set of input files and associated build settings.
|
||||
|
||||
@@ -77,7 +77,7 @@ export 'dart:io'
|
||||
WebSocketTransformer;
|
||||
|
||||
/// Exits the process with the given [exitCode].
|
||||
typedef void ExitFunction(int exitCode);
|
||||
typedef ExitFunction = void Function(int exitCode);
|
||||
|
||||
const ExitFunction _defaultExitFunction = io.exit;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'utils.dart';
|
||||
|
||||
const int kDefaultStatusPadding = 59;
|
||||
|
||||
typedef void VoidCallback();
|
||||
typedef VoidCallback = void Function();
|
||||
|
||||
abstract class Logger {
|
||||
bool get isVerbose => false;
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'io.dart';
|
||||
|
||||
const int kNetworkProblemExitCode = 50;
|
||||
|
||||
typedef HttpClient HttpClientFactory();
|
||||
typedef HttpClientFactory = HttpClient Function();
|
||||
|
||||
/// Download a file from the given URL and return the bytes.
|
||||
Future<List<int>> fetchUrl(Uri url) async {
|
||||
|
||||
@@ -11,10 +11,10 @@ import 'io.dart';
|
||||
import 'process_manager.dart';
|
||||
import 'utils.dart';
|
||||
|
||||
typedef String StringConverter(String string);
|
||||
typedef StringConverter = String Function(String string);
|
||||
|
||||
/// A function that will be run before the VM exits.
|
||||
typedef Future<dynamic> ShutdownHook();
|
||||
typedef ShutdownHook = Future<dynamic> Function();
|
||||
|
||||
// TODO(ianh): We have way too many ways to run subprocesses in this project.
|
||||
// Convert most of these into one or more lightweight wrappers around the
|
||||
|
||||
@@ -251,7 +251,7 @@ Map<String, dynamic> castStringKeyedMap(dynamic untyped) {
|
||||
|
||||
Clock get clock => context[Clock];
|
||||
|
||||
typedef Future<Null> AsyncCallback();
|
||||
typedef AsyncCallback = Future<Null> Function();
|
||||
|
||||
/// A [Timer] inspired class that:
|
||||
/// - has a different initial value for the first callback delay
|
||||
|
||||
@@ -73,9 +73,9 @@ class DaemonCommand extends FlutterCommand {
|
||||
}
|
||||
}
|
||||
|
||||
typedef void DispatchCommand(Map<String, dynamic> command);
|
||||
typedef DispatchCommand = void Function(Map<String, dynamic> command);
|
||||
|
||||
typedef Future<dynamic> CommandHandler(Map<String, dynamic> args);
|
||||
typedef CommandHandler = Future<dynamic> Function(Map<String, dynamic> args);
|
||||
|
||||
class Daemon {
|
||||
Daemon(
|
||||
@@ -305,7 +305,7 @@ class DaemonDomain extends Domain {
|
||||
}
|
||||
}
|
||||
|
||||
typedef Future<void> _RunOrAttach({
|
||||
typedef _RunOrAttach = Future<void> Function({
|
||||
Completer<DebugConnectionInfo> connectionInfoCompleter,
|
||||
Completer<void> appStartedCompleter
|
||||
});
|
||||
@@ -553,7 +553,7 @@ class AppDomain extends Domain {
|
||||
}
|
||||
}
|
||||
|
||||
typedef void _DeviceEventHandler(Device device);
|
||||
typedef _DeviceEventHandler = void Function(Device device);
|
||||
|
||||
/// This domain lets callers list and monitor connected devices.
|
||||
///
|
||||
|
||||
@@ -179,7 +179,7 @@ class DriveCommand extends RunCommandBase {
|
||||
}
|
||||
|
||||
/// Finds a device to test on. May launch a simulator, if necessary.
|
||||
typedef Future<Device> TargetDeviceFinder();
|
||||
typedef TargetDeviceFinder = Future<Device> Function();
|
||||
TargetDeviceFinder targetDeviceFinder = findTargetDevice;
|
||||
void restoreTargetDeviceFinder() {
|
||||
targetDeviceFinder = findTargetDevice;
|
||||
@@ -213,7 +213,7 @@ Future<Device> findTargetDevice() async {
|
||||
}
|
||||
|
||||
/// Starts the application on the device given command configuration.
|
||||
typedef Future<LaunchResult> AppStarter(DriveCommand command);
|
||||
typedef AppStarter = Future<LaunchResult> Function(DriveCommand command);
|
||||
|
||||
AppStarter appStarter = _startApp; // (mutable for testing)
|
||||
void restoreAppStarter() {
|
||||
@@ -272,7 +272,7 @@ Future<LaunchResult> _startApp(DriveCommand command) async {
|
||||
}
|
||||
|
||||
/// Runs driver tests.
|
||||
typedef Future<Null> TestRunner(List<String> testArgs, String observatoryUri);
|
||||
typedef TestRunner = Future<Null> Function(List<String> testArgs, String observatoryUri);
|
||||
TestRunner testRunner = _runTests;
|
||||
void restoreTestRunner() {
|
||||
testRunner = _runTests;
|
||||
@@ -299,7 +299,7 @@ Future<Null> _runTests(List<String> testArgs, String observatoryUri) async {
|
||||
|
||||
|
||||
/// Stops the application.
|
||||
typedef Future<bool> AppStopper(DriveCommand command);
|
||||
typedef AppStopper = Future<bool> Function(DriveCommand command);
|
||||
AppStopper appStopper = _stopApp;
|
||||
void restoreAppStopper() {
|
||||
appStopper = _stopApp;
|
||||
|
||||
@@ -17,7 +17,7 @@ import 'globals.dart';
|
||||
|
||||
KernelCompiler get kernelCompiler => context[KernelCompiler];
|
||||
|
||||
typedef void CompilerMessageConsumer(String message);
|
||||
typedef CompilerMessageConsumer = void Function(String message);
|
||||
|
||||
class CompilerOutput {
|
||||
final String outputFilename;
|
||||
|
||||
@@ -123,7 +123,7 @@ Future<Null> pubGet({
|
||||
throwToolExit('$directory: pub did not update .packages file (pubspec.yaml file has a newer timestamp)');
|
||||
}
|
||||
|
||||
typedef String MessageFilter(String message);
|
||||
typedef MessageFilter = String Function(String message);
|
||||
|
||||
/// Runs pub in 'batch' mode, forwarding complete lines written by pub to its
|
||||
/// stdout/stderr streams to the corresponding stream of this process, optionally
|
||||
|
||||
@@ -189,7 +189,7 @@ void main() {
|
||||
|
||||
enum _InitialResult { crashed, timedOut, connected }
|
||||
enum _TestResult { crashed, harnessBailed, testBailed }
|
||||
typedef Future<Null> _Finalizer();
|
||||
typedef _Finalizer = Future<Null> Function();
|
||||
|
||||
class _CompilationRequest {
|
||||
String path;
|
||||
|
||||
@@ -22,7 +22,7 @@ import 'globals.dart';
|
||||
import 'vmservice_record_replay.dart';
|
||||
|
||||
/// A function that opens a two-way communication channel to the specified [uri].
|
||||
typedef Future<StreamChannel<String>> _OpenChannel(Uri uri);
|
||||
typedef _OpenChannel = Future<StreamChannel<String>> Function(Uri uri);
|
||||
|
||||
_OpenChannel _openChannel = _defaultOpenChannel;
|
||||
|
||||
@@ -37,13 +37,13 @@ _OpenChannel _openChannel = _defaultOpenChannel;
|
||||
/// hot mode.
|
||||
///
|
||||
/// See: https://github.com/dart-lang/sdk/issues/30023
|
||||
typedef Future<Null> ReloadSources(
|
||||
typedef ReloadSources = Future<Null> Function(
|
||||
String isolateId, {
|
||||
bool force,
|
||||
bool pause,
|
||||
});
|
||||
|
||||
typedef Future<String> CompileExpression(
|
||||
typedef CompileExpression = Future<String> Function(
|
||||
String isolateId,
|
||||
String expression,
|
||||
List<String> definitions,
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||
import '../src/common.dart';
|
||||
import '../src/context.dart';
|
||||
|
||||
typedef FutureOr<Null> _TestMethod();
|
||||
typedef _TestMethod = FutureOr<Null> Function();
|
||||
|
||||
void main() {
|
||||
Cache.disableLocking();
|
||||
|
||||
@@ -146,7 +146,7 @@ void main() {
|
||||
});
|
||||
}
|
||||
|
||||
typedef void StartCallback(List<dynamic> command);
|
||||
typedef StartCallback = void Function(List<dynamic> command);
|
||||
|
||||
class MockProcessManager implements ProcessManager {
|
||||
MockProcessManager(this.fakeExitCode);
|
||||
|
||||
@@ -18,7 +18,7 @@ import 'package:process/process.dart';
|
||||
import '../src/common.dart';
|
||||
import '../src/context.dart';
|
||||
|
||||
typedef Future<ProcessResult> InvokeProcess();
|
||||
typedef InvokeProcess = Future<ProcessResult> Function();
|
||||
|
||||
void main() {
|
||||
FileSystem fs;
|
||||
|
||||
@@ -161,7 +161,7 @@ void main() {
|
||||
|
||||
}
|
||||
|
||||
typedef Future<FlutterCommandResult> CommandFunction();
|
||||
typedef CommandFunction = Future<FlutterCommandResult> Function();
|
||||
|
||||
class DummyFlutterCommand extends FlutterCommand {
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ BufferLogger get testLogger => context[Logger];
|
||||
MockDeviceManager get testDeviceManager => context[DeviceManager];
|
||||
MockDoctor get testDoctor => context[Doctor];
|
||||
|
||||
typedef void ContextInitializer(AppContext testContext);
|
||||
typedef ContextInitializer = void Function(AppContext testContext);
|
||||
|
||||
@isTest
|
||||
void testUsingContext(String description, dynamic testMethod(), {
|
||||
|
||||
@@ -109,7 +109,7 @@ ro.build.version.codename=REL
|
||||
}
|
||||
|
||||
/// A strategy for creating Process objects from a list of commands.
|
||||
typedef Process ProcessFactory(List<String> command);
|
||||
typedef ProcessFactory = Process Function(List<String> command);
|
||||
|
||||
/// A ProcessManager that starts Processes by delegating to a ProcessFactory.
|
||||
class MockProcessManager implements ProcessManager {
|
||||
|
||||
Reference in New Issue
Block a user