enable lint unnecessary_const (#19342)
This commit is contained in:
committed by
GitHub
parent
d10e46ea65
commit
cc1cf13eec
@@ -30,7 +30,7 @@ import 'android_sdk.dart';
|
||||
enum _HardwareType { emulator, physical }
|
||||
|
||||
/// Map to help our `isLocalEmulator` detection.
|
||||
const Map<String, _HardwareType> _knownHardware = const <String, _HardwareType>{
|
||||
const Map<String, _HardwareType> _knownHardware = <String, _HardwareType>{
|
||||
'goldfish': _HardwareType.emulator,
|
||||
'qcom': _HardwareType.physical,
|
||||
'ranchu': _HardwareType.emulator,
|
||||
@@ -695,7 +695,7 @@ class _AdbLogReader extends DeviceLogReader {
|
||||
_timeOrigin = null;
|
||||
runCommand(device.adbCommandForDevice(args)).then<Null>((Process process) {
|
||||
_process = process;
|
||||
const Utf8Decoder decoder = const Utf8Decoder(allowMalformed: true);
|
||||
const Utf8Decoder decoder = Utf8Decoder(allowMalformed: true);
|
||||
_process.stdout.transform(decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
_process.stderr.transform(decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
_process.exitCode.whenComplete(() {
|
||||
|
||||
@@ -292,7 +292,7 @@ class LocalEngineArtifacts extends Artifacts {
|
||||
}
|
||||
|
||||
String _genSnapshotPath() {
|
||||
const List<String> clangDirs = const <String>['.', 'clang_x86', 'clang_x64', 'clang_i386'];
|
||||
const List<String> clangDirs = <String>['.', 'clang_x86', 'clang_x64', 'clang_i386'];
|
||||
final String genSnapshotName = _artifactToFileName(Artifact.genSnapshot);
|
||||
for (String clangDir in clangDirs) {
|
||||
final String genSnapshotPath = fs.path.join(engineOutPath, clangDir, genSnapshotName);
|
||||
|
||||
@@ -18,7 +18,7 @@ import 'devfs.dart';
|
||||
import 'flutter_manifest.dart';
|
||||
import 'globals.dart';
|
||||
|
||||
const AssetBundleFactory _kManifestFactory = const _ManifestAssetBundleFactory();
|
||||
const AssetBundleFactory _kManifestFactory = _ManifestAssetBundleFactory();
|
||||
|
||||
/// Injected factory class for spawning [AssetBundle] instances.
|
||||
abstract class AssetBundleFactory {
|
||||
|
||||
@@ -170,7 +170,7 @@ class AppContext {
|
||||
class _Key {
|
||||
const _Key();
|
||||
|
||||
static const _Key key = const _Key();
|
||||
static const _Key key = _Key();
|
||||
|
||||
@override
|
||||
String toString() => 'context';
|
||||
@@ -180,5 +180,5 @@ class _Key {
|
||||
class _BoxedNull {
|
||||
const _BoxedNull();
|
||||
|
||||
static const _BoxedNull instance = const _BoxedNull();
|
||||
static const _BoxedNull instance = _BoxedNull();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export 'package:file/file.dart';
|
||||
export 'package:file/local.dart';
|
||||
|
||||
const String _kRecordingType = 'file';
|
||||
const FileSystem _kLocalFs = const LocalFileSystem();
|
||||
const FileSystem _kLocalFs = LocalFileSystem();
|
||||
|
||||
/// Currently active implementation of the file system.
|
||||
///
|
||||
|
||||
@@ -116,11 +116,11 @@ class ProcessSignal implements io.ProcessSignal {
|
||||
@visibleForTesting
|
||||
const ProcessSignal(this._delegate);
|
||||
|
||||
static const ProcessSignal SIGWINCH = const _PosixProcessSignal._(io.ProcessSignal.SIGWINCH); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGTERM = const _PosixProcessSignal._(io.ProcessSignal.SIGTERM); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGUSR1 = const _PosixProcessSignal._(io.ProcessSignal.SIGUSR1); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGUSR2 = const _PosixProcessSignal._(io.ProcessSignal.SIGUSR2); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGINT = const ProcessSignal(io.ProcessSignal.SIGINT); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGWINCH = _PosixProcessSignal._(io.ProcessSignal.SIGWINCH); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGTERM = _PosixProcessSignal._(io.ProcessSignal.SIGTERM); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGUSR1 = _PosixProcessSignal._(io.ProcessSignal.SIGUSR1); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGUSR2 = _PosixProcessSignal._(io.ProcessSignal.SIGUSR2); // ignore: deprecated_member_use
|
||||
static const ProcessSignal SIGINT = ProcessSignal(io.ProcessSignal.SIGINT); // ignore: deprecated_member_use
|
||||
|
||||
final io.ProcessSignal _delegate;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ abstract class OperatingSystemUtils {
|
||||
///
|
||||
/// If available, the detailed version of the OS is included.
|
||||
String get name {
|
||||
const Map<String, String> osNames = const <String, String>{
|
||||
const Map<String, String> osNames = <String, String>{
|
||||
'macos': 'Mac OS',
|
||||
'linux': 'Linux',
|
||||
'windows': 'Windows'
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'file_system.dart';
|
||||
|
||||
export 'package:platform/platform.dart';
|
||||
|
||||
const Platform _kLocalPlatform = const LocalPlatform();
|
||||
const Platform _kLocalPlatform = LocalPlatform();
|
||||
const String _kRecordingType = 'platform';
|
||||
|
||||
Platform get platform => context[Platform] ?? _kLocalPlatform;
|
||||
|
||||
@@ -33,19 +33,19 @@ class ShutdownStage implements Comparable<ShutdownStage> {
|
||||
|
||||
/// The stage before the invocation recording (if one exists) is serialized
|
||||
/// to disk. Tasks performed during this stage *will* be recorded.
|
||||
static const ShutdownStage STILL_RECORDING = const ShutdownStage._(1);
|
||||
static const ShutdownStage STILL_RECORDING = ShutdownStage._(1);
|
||||
|
||||
/// The stage during which the invocation recording (if one exists) will be
|
||||
/// serialized to disk. Invocations performed after this stage will not be
|
||||
/// recorded.
|
||||
static const ShutdownStage SERIALIZE_RECORDING = const ShutdownStage._(2);
|
||||
static const ShutdownStage SERIALIZE_RECORDING = ShutdownStage._(2);
|
||||
|
||||
/// The stage during which a serialized recording will be refined (e.g.
|
||||
/// cleansed for tests, zipped up for bug reporting purposes, etc.).
|
||||
static const ShutdownStage POST_PROCESS_RECORDING = const ShutdownStage._(3);
|
||||
static const ShutdownStage POST_PROCESS_RECORDING = ShutdownStage._(3);
|
||||
|
||||
/// The stage during which temporary files and directories will be deleted.
|
||||
static const ShutdownStage CLEANUP = const ShutdownStage._(4);
|
||||
static const ShutdownStage CLEANUP = ShutdownStage._(4);
|
||||
|
||||
@override
|
||||
int compareTo(ShutdownStage other) => priority.compareTo(other.priority);
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'file_system.dart';
|
||||
import 'process.dart';
|
||||
|
||||
const String _kRecordingType = 'process';
|
||||
const ProcessManager _kLocalProcessManager = const LocalProcessManager();
|
||||
const ProcessManager _kLocalProcessManager = LocalProcessManager();
|
||||
|
||||
/// The active process manager.
|
||||
ProcessManager get processManager => context[ProcessManager] ?? _kLocalProcessManager;
|
||||
@@ -27,7 +27,7 @@ ProcessManager get processManager => context[ProcessManager] ?? _kLocalProcessMa
|
||||
/// subdirectory.
|
||||
RecordingProcessManager getRecordingProcessManager(String location) {
|
||||
final Directory dir = getRecordingSink(location, _kRecordingType);
|
||||
const ProcessManager delegate = const LocalProcessManager();
|
||||
const ProcessManager delegate = LocalProcessManager();
|
||||
final RecordingProcessManager manager = new RecordingProcessManager(delegate, dir);
|
||||
addShutdownHook(() async {
|
||||
await manager.flush(finishRunningProcesses: true);
|
||||
|
||||
@@ -33,7 +33,7 @@ class AnsiTerminal {
|
||||
|
||||
/// Setting the line mode can throw for some terminals (with "Operation not
|
||||
/// supported on socket"), but the error can be safely ignored.
|
||||
static const List<int> _lineModeIgnorableErrors = const <int>[
|
||||
static const List<int> _lineModeIgnorableErrors = <int>[
|
||||
_EBADF,
|
||||
_ENXIO,
|
||||
_ENOTTY,
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'context.dart';
|
||||
import 'file_system.dart';
|
||||
import 'platform.dart';
|
||||
|
||||
const BotDetector _kBotDetector = const BotDetector();
|
||||
const BotDetector _kBotDetector = BotDetector();
|
||||
|
||||
class BotDetector {
|
||||
const BotDetector();
|
||||
|
||||
@@ -71,9 +71,9 @@ class BuildInfo {
|
||||
/// On Xcode builds it is used as CFBundleShortVersionString,
|
||||
final String buildName;
|
||||
|
||||
static const BuildInfo debug = const BuildInfo(BuildMode.debug, null);
|
||||
static const BuildInfo profile = const BuildInfo(BuildMode.profile, null);
|
||||
static const BuildInfo release = const BuildInfo(BuildMode.release, null);
|
||||
static const BuildInfo debug = BuildInfo(BuildMode.debug, null);
|
||||
static const BuildInfo profile = BuildInfo(BuildMode.profile, null);
|
||||
static const BuildInfo release = BuildInfo(BuildMode.release, null);
|
||||
|
||||
/// Returns whether a debug build is requested.
|
||||
///
|
||||
@@ -174,7 +174,7 @@ enum IOSArch {
|
||||
}
|
||||
|
||||
/// The default set of iOS device architectures to build for.
|
||||
const List<IOSArch> defaultIOSArchs = const <IOSArch>[
|
||||
const List<IOSArch> defaultIOSArchs = <IOSArch>[
|
||||
IOSArch.arm64,
|
||||
];
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class Cache {
|
||||
}
|
||||
}
|
||||
|
||||
static const List<String> _hostsBlockedInChina = const <String> [
|
||||
static const List<String> _hostsBlockedInChina = <String> [
|
||||
'storage.googleapis.com',
|
||||
];
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class PackageDependency {
|
||||
|
||||
class PackageDependencyTracker {
|
||||
/// Packages whose source is defined in the vended SDK.
|
||||
static const List<String> _vendedSdkPackages = const <String>['analyzer', 'front_end', 'kernel'];
|
||||
static const List<String> _vendedSdkPackages = <String>['analyzer', 'front_end', 'kernel'];
|
||||
|
||||
// This is a map from package names to objects that track the paths
|
||||
// involved (sources and targets).
|
||||
|
||||
@@ -25,7 +25,7 @@ import '../runner/flutter_command.dart';
|
||||
/// ```
|
||||
/// 'linter': '0.1.35', // TODO(yjbanov): https://github.com/dart-lang/linter/issues/824
|
||||
/// ```
|
||||
const Map<String, String> _kManuallyPinnedDependencies = const <String, String>{
|
||||
const Map<String, String> _kManuallyPinnedDependencies = <String, String>{
|
||||
// Add pinned packages here.
|
||||
'mockito': '3.0.0-beta', // TODO(aam): https://github.com/dart-lang/mockito/issues/110
|
||||
'matcher': '0.12.2', // TODO(ianh): https://github.com/flutter/flutter/issues/18608, https://github.com/dart-lang/matcher/pull/88
|
||||
@@ -1192,7 +1192,7 @@ int _computeChecksum(List<String> values) {
|
||||
|
||||
// The exact versioning is tricky to figure out for these, but the packages aren't
|
||||
// frequently added or removed by users - it should be okay.
|
||||
const List<String> _ignoreForChecksum = const <String>[
|
||||
const List<String> _ignoreForChecksum = <String>[
|
||||
'analyzer',
|
||||
'flutter',
|
||||
'flutter_test',
|
||||
|
||||
@@ -12,7 +12,7 @@ String get dartSdkPath {
|
||||
}
|
||||
|
||||
/// The required Dart language flags
|
||||
const List<String> dartVmFlags = const <String>[];
|
||||
const List<String> dartVmFlags = <String>[];
|
||||
|
||||
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
|
||||
/// ==> `pub.bat`. The default SDK location can be overridden with a specified
|
||||
|
||||
@@ -129,8 +129,8 @@ abstract class DeviceDiscovery {
|
||||
abstract class PollingDeviceDiscovery extends DeviceDiscovery {
|
||||
PollingDeviceDiscovery(this.name);
|
||||
|
||||
static const Duration _pollingInterval = const Duration(seconds: 4);
|
||||
static const Duration _pollingTimeout = const Duration(seconds: 30);
|
||||
static const Duration _pollingInterval = Duration(seconds: 4);
|
||||
static const Duration _pollingTimeout = Duration(seconds: 30);
|
||||
|
||||
final String name;
|
||||
ItemListNotifier<Device> _items;
|
||||
|
||||
@@ -127,7 +127,7 @@ class EmulatorManager {
|
||||
);
|
||||
}
|
||||
|
||||
static const List<String> preferredDevices = const <String>[
|
||||
static const List<String> preferredDevices = <String>[
|
||||
'pixel',
|
||||
'pixel_xl',
|
||||
];
|
||||
|
||||
@@ -118,7 +118,7 @@ Future<Map<String, String>> getCodeSigningIdentityDevelopmentTeam({
|
||||
return null;
|
||||
|
||||
const List<String> findIdentityCommand =
|
||||
const <String>['security', 'find-identity', '-p', 'codesigning', '-v'];
|
||||
<String>['security', 'find-identity', '-p', 'codesigning', '-v'];
|
||||
final List<String> validCodeSigningIdentities = runCheckedSync(findIdentityCommand)
|
||||
.split('\n')
|
||||
.map<String>((String outputLine) {
|
||||
|
||||
@@ -26,7 +26,7 @@ const String _kIdeviceinstallerInstructions =
|
||||
'To work with iOS devices, please install ideviceinstaller. To install, run:\n'
|
||||
'brew install ideviceinstaller.';
|
||||
|
||||
const Duration kPortForwardTimeout = const Duration(seconds: 10);
|
||||
const Duration kPortForwardTimeout = Duration(seconds: 10);
|
||||
|
||||
class IOSDeploy {
|
||||
const IOSDeploy();
|
||||
@@ -531,7 +531,7 @@ class _IOSDevicePortForwarder extends DevicePortForwarder {
|
||||
@override
|
||||
List<ForwardedPort> get forwardedPorts => _forwardedPorts;
|
||||
|
||||
static const Duration _kiProxyPortForwardTimeout = const Duration(seconds: 1);
|
||||
static const Duration _kiProxyPortForwardTimeout = Duration(seconds: 1);
|
||||
|
||||
@override
|
||||
Future<int> forward(int devicePort, {int hostPort}) async {
|
||||
|
||||
@@ -145,10 +145,10 @@ class SimControlListSection {
|
||||
|
||||
final String name;
|
||||
|
||||
static const SimControlListSection devices = const SimControlListSection._('devices');
|
||||
static const SimControlListSection devicetypes = const SimControlListSection._('devicetypes');
|
||||
static const SimControlListSection runtimes = const SimControlListSection._('runtimes');
|
||||
static const SimControlListSection pairs = const SimControlListSection._('pairs');
|
||||
static const SimControlListSection devices = SimControlListSection._('devices');
|
||||
static const SimControlListSection devicetypes = SimControlListSection._('devicetypes');
|
||||
static const SimControlListSection runtimes = SimControlListSection._('runtimes');
|
||||
static const SimControlListSection pairs = SimControlListSection._('pairs');
|
||||
}
|
||||
|
||||
/// A simulated device type.
|
||||
@@ -668,7 +668,7 @@ int compareIphoneVersions(String id1, String id2) {
|
||||
return v1.compareTo(v2);
|
||||
|
||||
// Sorted in the least preferred first order.
|
||||
const List<String> qualifiers = const <String>['-Plus', '', 's-Plus', 's'];
|
||||
const List<String> qualifiers = <String>['-Plus', '', 's-Plus', 's'];
|
||||
|
||||
final int q1 = qualifiers.indexOf(m1[2]);
|
||||
final int q2 = qualifiers.indexOf(m2[2]);
|
||||
|
||||
@@ -25,12 +25,12 @@ import 'watcher.dart';
|
||||
|
||||
/// The timeout we give the test process to connect to the test harness
|
||||
/// once the process has entered its main method.
|
||||
const Duration _kTestStartupTimeout = const Duration(minutes: 1);
|
||||
const Duration _kTestStartupTimeout = Duration(minutes: 1);
|
||||
|
||||
/// The timeout we give the test process to start executing Dart code. When the
|
||||
/// CPU is under severe load, this can take a while, but it's not indicative of
|
||||
/// any problem with Flutter, so we give it a large timeout.
|
||||
const Duration _kTestProcessTimeout = const Duration(minutes: 5);
|
||||
const Duration _kTestProcessTimeout = Duration(minutes: 5);
|
||||
|
||||
/// Message logged by the test process to signal that its main method has begun
|
||||
/// execution.
|
||||
|
||||
@@ -206,20 +206,20 @@ class FlutterVersion {
|
||||
/// The amount of time we wait before pinging the server to check for the
|
||||
/// availability of a newer version of Flutter.
|
||||
@visibleForTesting
|
||||
static const Duration kCheckAgeConsideredUpToDate = const Duration(days: 3);
|
||||
static const Duration kCheckAgeConsideredUpToDate = Duration(days: 3);
|
||||
|
||||
/// We warn the user if the age of their Flutter installation is greater than
|
||||
/// this duration.
|
||||
///
|
||||
/// This is set to 5 weeks because releases are currently around every 4 weeks.
|
||||
@visibleForTesting
|
||||
static const Duration kVersionAgeConsideredUpToDate = const Duration(days: 35);
|
||||
static const Duration kVersionAgeConsideredUpToDate = Duration(days: 35);
|
||||
|
||||
/// The amount of time we wait between issuing a warning.
|
||||
///
|
||||
/// This is to avoid annoying users who are unable to upgrade right away.
|
||||
@visibleForTesting
|
||||
static const Duration kMaxTimeSinceLastWarning = const Duration(days: 1);
|
||||
static const Duration kMaxTimeSinceLastWarning = Duration(days: 1);
|
||||
|
||||
/// The amount of time we pause for to let the user read the message about
|
||||
/// outdated Flutter installation.
|
||||
@@ -418,7 +418,7 @@ class VersionCheckStamp {
|
||||
if (newTimeWarningWasPrinted != null)
|
||||
jsonData['lastTimeWarningWasPrinted'] = '$newTimeWarningWasPrinted';
|
||||
|
||||
const JsonEncoder kPrettyJsonEncoder = const JsonEncoder.withIndent(' ');
|
||||
const JsonEncoder kPrettyJsonEncoder = JsonEncoder.withIndent(' ');
|
||||
Cache.instance.setStampFor(kFlutterVersionCheckStampFile, kPrettyJsonEncoder.convert(jsonData));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,13 +94,13 @@ Future<StreamChannel<String>> _defaultOpenChannel(Uri uri) async {
|
||||
}
|
||||
|
||||
/// The default VM service request timeout.
|
||||
const Duration kDefaultRequestTimeout = const Duration(seconds: 30);
|
||||
const Duration kDefaultRequestTimeout = Duration(seconds: 30);
|
||||
|
||||
/// Used for RPC requests that may take a long time.
|
||||
const Duration kLongRequestTimeout = const Duration(minutes: 1);
|
||||
const Duration kLongRequestTimeout = Duration(minutes: 1);
|
||||
|
||||
/// Used for RPC requests that should never take a long time.
|
||||
const Duration kShortRequestTimeout = const Duration(seconds: 5);
|
||||
const Duration kShortRequestTimeout = Duration(seconds: 5);
|
||||
|
||||
/// A connection to the Dart VM Service.
|
||||
class VMService {
|
||||
|
||||
Reference in New Issue
Block a user