prefer_const_declarations on local variables (#14358)
This commit is contained in:
committed by
GitHub
parent
b0e17949aa
commit
841d5d7bd5
@@ -683,7 +683,7 @@ class _AdbLogReader extends DeviceLogReader {
|
||||
_timeOrigin = null;
|
||||
runCommand(device.adbCommandForDevice(args)).then<Null>((Process process) {
|
||||
_process = process;
|
||||
final Utf8Decoder decoder = const Utf8Decoder(allowMalformed: true);
|
||||
const Utf8Decoder decoder = const Utf8Decoder(allowMalformed: true);
|
||||
_process.stdout.transform(decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
_process.stderr.transform(decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
_process.exitCode.whenComplete(() {
|
||||
|
||||
@@ -35,7 +35,7 @@ ProcessManager get processManager {
|
||||
void enableRecordingProcessManager(String location) {
|
||||
final ProcessManager originalProcessManager = processManager;
|
||||
final Directory dir = getRecordingSink(location, _kRecordingType);
|
||||
final ProcessManager delegate = const LocalProcessManager();
|
||||
const ProcessManager delegate = const LocalProcessManager();
|
||||
final RecordingProcessManager manager = new RecordingProcessManager(delegate, dir);
|
||||
addShutdownHook(() async {
|
||||
await manager.flush(finishRunningProcesses: true);
|
||||
|
||||
@@ -40,7 +40,7 @@ abstract class AnalyzeBase {
|
||||
}
|
||||
|
||||
void writeBenchmark(Stopwatch stopwatch, int errorCount, int membersMissingDocumentation) {
|
||||
final String benchmarkOut = 'analysis_benchmark.json';
|
||||
const String benchmarkOut = 'analysis_benchmark.json';
|
||||
final Map<String, dynamic> data = <String, dynamic>{
|
||||
'time': (stopwatch.elapsedMilliseconds / 1000.0),
|
||||
'issues': errorCount,
|
||||
|
||||
@@ -251,7 +251,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
|
||||
final Uri vmServiceAddr = isolate.owner.vmService.httpAddress;
|
||||
final String name = isolate.name;
|
||||
final String shortName = name.substring(0, name.indexOf('\$'));
|
||||
final String main = '\$main-';
|
||||
const String main = '\$main-';
|
||||
final String number = name.substring(name.indexOf(main) + main.length);
|
||||
|
||||
// The Observatory requires somewhat non-standard URIs that the Uri class
|
||||
|
||||
@@ -95,7 +95,7 @@ class TestCommand extends FlutterCommand {
|
||||
..writeAsStringSync(coverageData, flush: true);
|
||||
printTrace('wrote coverage data to $coveragePath (size=${coverageData.length})');
|
||||
|
||||
final String baseCoverageData = 'coverage/lcov.base.info';
|
||||
const String baseCoverageData = 'coverage/lcov.base.info';
|
||||
if (mergeCoverageData) {
|
||||
if (!platform.isLinux) {
|
||||
printError(
|
||||
|
||||
@@ -232,7 +232,7 @@ class _FlutterValidator extends DoctorValidator {
|
||||
}
|
||||
|
||||
bool _genSnapshotRuns(String genSnapshotPath) {
|
||||
final int kExpectedExitCode = 255;
|
||||
const int kExpectedExitCode = 255;
|
||||
try {
|
||||
return processManager.runSync(<String>[genSnapshotPath]).exitCode == kExpectedExitCode;
|
||||
} catch (error) {
|
||||
@@ -355,7 +355,7 @@ abstract class IntelliJValidator extends DoctorValidator {
|
||||
final Archive archive = new ZipDecoder().decodeBytes(fs.file(jarPath).readAsBytesSync());
|
||||
final ArchiveFile file = archive.findFile('META-INF/plugin.xml');
|
||||
final String content = UTF8.decode(file.content);
|
||||
final String versionStartTag = '<version>';
|
||||
const String versionStartTag = '<version>';
|
||||
final int start = content.indexOf(versionStartTag);
|
||||
final int end = content.indexOf('</version>', start);
|
||||
return content.substring(start + versionStartTag.length, end);
|
||||
|
||||
@@ -107,7 +107,7 @@ Future<String> getCodeSigningIdentityDevelopmentTeam({BuildableIOSApp iosApp, bo
|
||||
if (!exitsHappy(const <String>['which', 'security']) || !exitsHappy(const <String>['which', 'openssl']))
|
||||
return null;
|
||||
|
||||
final List<String> findIdentityCommand =
|
||||
const List<String> findIdentityCommand =
|
||||
const <String>['security', 'find-identity', '-p', 'codesigning', '-v'];
|
||||
final List<String> validCodeSigningIdentities = runCheckedSync(findIdentityCommand)
|
||||
.split('\n')
|
||||
|
||||
@@ -528,14 +528,14 @@ Future<bool> upgradePbxProjWithFlutterAssets(String app) async {
|
||||
if (lines.any((String line) => line.contains('path = Flutter/flutter_assets')))
|
||||
return true;
|
||||
|
||||
final String l1 = ' 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };';
|
||||
final String l2 = ' 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };';
|
||||
final String l3 = ' 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };';
|
||||
final String l4 = ' 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };';
|
||||
final String l5 = ' 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,';
|
||||
final String l6 = ' 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,';
|
||||
final String l7 = ' 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,';
|
||||
final String l8 = ' 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,';
|
||||
const String l1 = ' 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };';
|
||||
const String l2 = ' 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };';
|
||||
const String l3 = ' 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };';
|
||||
const String l4 = ' 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };';
|
||||
const String l5 = ' 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,';
|
||||
const String l6 = ' 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,';
|
||||
const String l7 = ' 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,';
|
||||
const String l8 = ' 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,';
|
||||
|
||||
|
||||
printStatus("Upgrading project.pbxproj of $app' to include the "
|
||||
@@ -561,10 +561,10 @@ Future<bool> upgradePbxProjWithFlutterAssets(String app) async {
|
||||
lines.insert(lines.indexOf(l5) + 1, l6);
|
||||
lines.insert(lines.indexOf(l7) + 1, l8);
|
||||
|
||||
final String l9 = ' 9740EEBB1CF902C7004384FC /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; };';
|
||||
final String l10 = ' 9740EEB71CF902C7004384FC /* app.flx */ = {isa = PBXFileReference; lastKnownFileType = file; name = app.flx; path = Flutter/app.flx; sourceTree = "<group>"; };';
|
||||
final String l11 = ' 9740EEB71CF902C7004384FC /* app.flx */,';
|
||||
final String l12 = ' 9740EEBB1CF902C7004384FC /* app.flx in Resources */,';
|
||||
const String l9 = ' 9740EEBB1CF902C7004384FC /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; };';
|
||||
const String l10 = ' 9740EEB71CF902C7004384FC /* app.flx */ = {isa = PBXFileReference; lastKnownFileType = file; name = app.flx; path = Flutter/app.flx; sourceTree = "<group>"; };';
|
||||
const String l11 = ' 9740EEB71CF902C7004384FC /* app.flx */,';
|
||||
const String l12 = ' 9740EEBB1CF902C7004384FC /* app.flx in Resources */,';
|
||||
|
||||
if (lines.contains(l9)) {
|
||||
printStatus('Removing app.flx from project.pbxproj since it has been '
|
||||
|
||||
@@ -570,7 +570,7 @@ void main() {
|
||||
void startTimeoutTimer(),
|
||||
void reportObservatoryUri(Uri uri),
|
||||
}) {
|
||||
final String observatoryString = 'Observatory listening on ';
|
||||
const String observatoryString = 'Observatory listening on ';
|
||||
|
||||
for (Stream<List<int>> stream in
|
||||
<Stream<List<int>>>[process.stderr, process.stdout]) {
|
||||
|
||||
Reference in New Issue
Block a user