prefer_const_declarations on local variables (#14358)
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index a0a19c0..9c9cac6 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -683,7 +683,7 @@
_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(() {
diff --git a/packages/flutter_tools/lib/src/base/process_manager.dart b/packages/flutter_tools/lib/src/base/process_manager.dart
index 447a3ba..bb39578 100644
--- a/packages/flutter_tools/lib/src/base/process_manager.dart
+++ b/packages/flutter_tools/lib/src/base/process_manager.dart
@@ -35,7 +35,7 @@
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);
diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart
index 1661242..22874b0 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_base.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart
@@ -40,7 +40,7 @@
}
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,
diff --git a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
index 273aa72..cafc0a6 100644
--- a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
+++ b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
@@ -251,7 +251,7 @@
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
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index d53ebe5..5e7b3bc 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -95,7 +95,7 @@
..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(
diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart
index 685bd0e..040d12c 100644
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -232,7 +232,7 @@
}
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 @@
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);
diff --git a/packages/flutter_tools/lib/src/ios/code_signing.dart b/packages/flutter_tools/lib/src/ios/code_signing.dart
index 2efbfdf..b891e29 100644
--- a/packages/flutter_tools/lib/src/ios/code_signing.dart
+++ b/packages/flutter_tools/lib/src/ios/code_signing.dart
@@ -107,7 +107,7 @@
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')
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index b5b126c..eead7f3 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -528,14 +528,14 @@
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 @@
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 '
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index 2dc3490..62788d5 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -570,7 +570,7 @@
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]) {
diff --git a/packages/flutter_tools/test/android/android_device_test.dart b/packages/flutter_tools/test/android/android_device_test.dart
index b4b7474..5ee2c58 100644
--- a/packages/flutter_tools/test/android/android_device_test.dart
+++ b/packages/flutter_tools/test/android/android_device_test.dart
@@ -15,7 +15,7 @@
void main() {
group('android_device', () {
testUsingContext('stores the requested id', () {
- final String deviceId = '1234';
+ const String deviceId = '1234';
final AndroidDevice device = new AndroidDevice(deviceId);
expect(device.id, deviceId);
});
diff --git a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
index ec1a996..8c720b5 100644
--- a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
+++ b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
@@ -130,7 +130,7 @@
testUsingContext('App font uses font file from package', () async {
establishFlutterRoot();
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: packages/test_package/bar
@@ -139,10 +139,10 @@
writePackagesFile('test_package:p/p/lib/');
writePubspecFile('p/p/pubspec.yaml', 'test_package');
- final String font = 'bar';
+ const String font = 'bar';
writeFontAsset('p/p/lib/', font);
- final String expectedFontManifest =
+ const String expectedFontManifest =
'[{"fonts":[{"asset":"packages/test_package/bar"}],"family":"foo"}]';
await buildAndVerifyFonts(
<String>[],
@@ -155,7 +155,7 @@
testUsingContext('App font uses local font file and package font file', () async {
establishFlutterRoot();
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: packages/test_package/bar
@@ -165,9 +165,9 @@
writePackagesFile('test_package:p/p/lib/');
writePubspecFile('p/p/pubspec.yaml', 'test_package');
- final String packageFont = 'bar';
+ const String packageFont = 'bar';
writeFontAsset('p/p/lib/', packageFont);
- final String localFont = 'a/bar';
+ const String localFont = 'a/bar';
writeFontAsset('', localFont);
final String expectedFontManifest =
@@ -186,7 +186,7 @@
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: a/bar
@@ -197,7 +197,7 @@
fontsSection: fontsSection,
);
- final String font = 'a/bar';
+ const String font = 'a/bar';
writeFontAsset('p/p/', font);
final String expectedFontManifest =
@@ -216,7 +216,7 @@
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/\ntest_package2:p2/p/lib/');
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: packages/test_package2/bar
@@ -228,7 +228,7 @@
);
writePubspecFile('p2/p/pubspec.yaml', 'test_package2');
- final String font = 'bar';
+ const String font = 'bar';
writeFontAsset('p2/p/lib/', font);
final String expectedFontManifest =
@@ -248,7 +248,7 @@
writePubspecFile('pubspec.yaml', 'test');
writePackagesFile('test_package:p/p/lib/');
- final String pubspec = '''
+ const String pubspec = '''
- family: foo
fonts:
- style: italic
@@ -260,7 +260,7 @@
'test_package',
fontsSection: pubspec,
);
- final String font = 'a/bar';
+ const String font = 'a/bar';
writeFontAsset('p/p/', font);
final String expectedFontManifest =
@@ -277,7 +277,7 @@
testUsingContext('App uses local font and package font with own font file.', () async {
establishFlutterRoot();
- final String fontsSection = '''
+ const String fontsSection = '''
- family: foo
fonts:
- asset: a/bar
@@ -294,7 +294,7 @@
fontsSection: fontsSection,
);
- final String font = 'a/bar';
+ const String font = 'a/bar';
writeFontAsset('', font);
writeFontAsset('p/p/', font);
diff --git a/packages/flutter_tools/test/asset_bundle_package_test.dart b/packages/flutter_tools/test/asset_bundle_package_test.dart
index dc9dfe6..af1183c 100644
--- a/packages/flutter_tools/test/asset_bundle_package_test.dart
+++ b/packages/flutter_tools/test/asset_bundle_package_test.dart
@@ -125,7 +125,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 2); // LICENSE, AssetManifest
- final String expectedAssetManifest = '{}';
+ const String expectedAssetManifest = '{}';
expect(
UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
expectedAssetManifest,
@@ -145,7 +145,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 2); // LICENSE, AssetManifest
- final String expectedAssetManifest = '{}';
+ const String expectedAssetManifest = '{}';
expect(
UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
expectedAssetManifest,
diff --git a/packages/flutter_tools/test/asset_bundle_test.dart b/packages/flutter_tools/test/asset_bundle_test.dart
index b485fe6..64c8763 100644
--- a/packages/flutter_tools/test/asset_bundle_test.dart
+++ b/packages/flutter_tools/test/asset_bundle_test.dart
@@ -56,8 +56,8 @@
// Create a temporary directory and write a single file into it.
final Directory tempDir = fs.systemTempDirectory.createTempSync();
final String projectRoot = tempDir.path;
- final String assetPath = 'banana.txt';
- final String assetContents = 'banana';
+ const String assetPath = 'banana.txt';
+ const String assetContents = 'banana';
final File tempFile = fs.file(fs.path.join(projectRoot, assetPath));
tempFile.parent.createSync(recursive: true);
tempFile.writeAsBytesSync(UTF8.encode(assetContents));
@@ -111,7 +111,7 @@
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 1);
- final String expectedAssetManifest = '{}';
+ const String expectedAssetManifest = '{}';
expect(
UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
expectedAssetManifest,
diff --git a/packages/flutter_tools/test/base/file_system_test.dart b/packages/flutter_tools/test/base/file_system_test.dart
index 9ef0059..f39c325 100644
--- a/packages/flutter_tools/test/base/file_system_test.dart
+++ b/packages/flutter_tools/test/base/file_system_test.dart
@@ -34,7 +34,7 @@
/// Copies between 2 instances of file systems which is also supported by copyDirectorySync().
test('test directory copy', () async {
final MemoryFileSystem sourceMemoryFs = new MemoryFileSystem();
- final String sourcePath = '/some/origin';
+ const String sourcePath = '/some/origin';
final Directory sourceDirectory = await sourceMemoryFs.directory(sourcePath).create(recursive: true);
sourceMemoryFs.currentDirectory = sourcePath;
final File sourceFile1 = sourceMemoryFs.file('some_file.txt')..writeAsStringSync('bleh');
@@ -44,7 +44,7 @@
// Copy to another memory file system instance.
final MemoryFileSystem targetMemoryFs = new MemoryFileSystem();
- final String targetPath = '/some/non-existent/target';
+ const String targetPath = '/some/non-existent/target';
final Directory targetDirectory = targetMemoryFs.directory(targetPath);
copyDirectorySync(sourceDirectory, targetDirectory);
diff --git a/packages/flutter_tools/test/dependency_checker_test.dart b/packages/flutter_tools/test/dependency_checker_test.dart
index 224b44d..ecc76df 100644
--- a/packages/flutter_tools/test/dependency_checker_test.dart
+++ b/packages/flutter_tools/test/dependency_checker_test.dart
@@ -95,7 +95,7 @@
testUsingContext('moved flutter sdk', () async {
final Directory destinationPath = fs.systemTempDirectory.createTempSync('dependency_checker_test_');
// Copy the golden input and let the test run in an isolated temporary in-memory file system.
- final LocalFileSystem localFileSystem = const LocalFileSystem();
+ const LocalFileSystem localFileSystem = const LocalFileSystem();
final Directory sourcePath = localFileSystem.directory(localFileSystem.path.join(dataPath, 'changed_sdk_location'));
copyDirectorySync(sourcePath, destinationPath);
fs.currentDirectory = destinationPath;
diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart
index 19eaa3e..3e802b6 100644
--- a/packages/flutter_tools/test/devfs_test.dart
+++ b/packages/flutter_tools/test/devfs_test.dart
@@ -186,7 +186,7 @@
});
testUsingContext('add new package with double slashes in URI', () async {
- final String packageName = 'doubleslashpkg';
+ const String packageName = 'doubleslashpkg';
await _createPackage(fs, packageName, 'somefile.txt', doubleSlash: true);
final Set<String> fileFilter = new Set<String>();
diff --git a/packages/flutter_tools/test/flutter_manifest_test.dart b/packages/flutter_tools/test/flutter_manifest_test.dart
index ee7e0e6..56e7a99 100644
--- a/packages/flutter_tools/test/flutter_manifest_test.dart
+++ b/packages/flutter_tools/test/flutter_manifest_test.dart
@@ -27,7 +27,7 @@
});
test('has no fonts or assets when the "flutter" section is empty', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -44,7 +44,7 @@
});
test('knows if material design is used', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -57,7 +57,7 @@
});
test('has two assets', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -75,7 +75,7 @@
});
test('has one font family with one asset', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -93,7 +93,7 @@
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font font = fonts[0];
- final String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}]}';
+ const String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}]}';
expect(font.descriptor.toString(), fontDescriptor);
expect(font.familyName, 'foo');
final List<FontAsset> assets = font.fontAssets;
@@ -105,7 +105,7 @@
});
test('has one font family with a simple asset and one with weight', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -121,12 +121,12 @@
''';
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
- final String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {weight: 400, asset: a/bar}], family: foo}]';
+ const String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {weight: 400, asset: a/bar}], family: foo}]';
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font font = fonts[0];
- final String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, asset: a/bar}]}';
+ const String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, asset: a/bar}]}';
expect(font.descriptor.toString(), fontDescriptor);
expect(font.familyName, 'foo');
final List<FontAsset> assets = font.fontAssets;
@@ -142,7 +142,7 @@
});
test('has one font family with a simple asset and one with weight and style', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -159,12 +159,12 @@
''';
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
- final String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo}]';
+ const String expectedFontsDescriptor = '[{fonts: [{asset: a/bar}, {style: italic, weight: 400, asset: a/bar}], family: foo}]';
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font font = fonts[0];
- final String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
+ const String fontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
expect(font.descriptor.toString(), fontDescriptor);
expect(font.familyName, 'foo');
final List<FontAsset> assets = font.fontAssets;
@@ -180,7 +180,7 @@
});
test('has two font families, each with one simple asset and one with weight and style', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -210,7 +210,7 @@
expect(fonts.length, 2);
final Font fooFont = fonts[0];
- final String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
+ const String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
expect(fooFont.descriptor.toString(), barFontDescriptor);
expect(fooFont.familyName, 'foo');
final List<FontAsset> fooAassets = fooFont.fontAssets;
@@ -225,7 +225,7 @@
expect(fooFontAsset1.style, 'italic');
final Font barFont = fonts[1];
- final String fontDescriptor = '{family: bar, fonts: [{asset: a/baz}, {weight: 400, style: italic, asset: a/baz}]}';
+ const String fontDescriptor = '{family: bar, fonts: [{asset: a/baz}, {weight: 400, style: italic, asset: a/baz}]}';
expect(barFont.descriptor.toString(), fontDescriptor);
expect(barFont.familyName, 'bar');
final List<FontAsset> barAssets = barFont.fontAssets;
@@ -241,7 +241,7 @@
});
testUsingContext('has only one of two font familes when one declaration is missing the "family" option', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -270,7 +270,7 @@
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font fooFont = fonts[0];
- final String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
+ const String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
expect(fooFont.descriptor.toString(), barFontDescriptor);
expect(fooFont.familyName, 'foo');
final List<FontAsset> fooAassets = fooFont.fontAssets;
@@ -286,7 +286,7 @@
});
testUsingContext('has only one of two font familes when one declaration is missing the "fonts" option', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -310,7 +310,7 @@
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 1);
final Font fooFont = fonts[0];
- final String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
+ const String barFontDescriptor = '{family: foo, fonts: [{asset: a/bar}, {weight: 400, style: italic, asset: a/bar}]}';
expect(fooFont.descriptor.toString(), barFontDescriptor);
expect(fooFont.familyName, 'foo');
final List<FontAsset> fooAassets = fooFont.fontAssets;
@@ -326,7 +326,7 @@
});
testUsingContext('has no font family when declaration is missing the "asset" option', () async {
- final String manifest = '''
+ const String manifest = '''
name: test
dependencies:
flutter:
@@ -340,7 +340,7 @@
''';
final FlutterManifest flutterManifest = await FlutterManifest.createFromString(manifest);
- final String expectedFontsDescriptor = '[{fonts: [{weight: 400}], family: foo}]';
+ const String expectedFontsDescriptor = '[{fonts: [{weight: 400}], family: foo}]';
expect(flutterManifest.fontsDescriptor.toString(), expectedFontsDescriptor);
final List<Font> fonts = flutterManifest.fonts;
expect(fonts.length, 0);
diff --git a/packages/flutter_tools/test/ios/mac_test.dart b/packages/flutter_tools/test/ios/mac_test.dart
index 3bdd6e2..7b59f5e 100644
--- a/packages/flutter_tools/test/ios/mac_test.dart
+++ b/packages/flutter_tools/test/ios/mac_test.dart
@@ -113,7 +113,7 @@
});
testUsingContext('xcodeSelectPath returns path when xcode-select is installed', () {
- final String xcodePath = '/Applications/Xcode8.0.app/Contents/Developer';
+ const String xcodePath = '/Applications/Xcode8.0.app/Contents/Developer';
when(mockProcessManager.runSync(<String>['/usr/bin/xcode-select', '--print-path']))
.thenReturn(new ProcessResult(1, 0, xcodePath, ''));
expect(xcode.xcodeSelectPath, xcodePath);
diff --git a/packages/flutter_tools/test/ios/xcodeproj_test.dart b/packages/flutter_tools/test/ios/xcodeproj_test.dart
index a8eeb7f..75cec8a 100644
--- a/packages/flutter_tools/test/ios/xcodeproj_test.dart
+++ b/packages/flutter_tools/test/ios/xcodeproj_test.dart
@@ -6,7 +6,7 @@
void main() {
group('Xcode project properties', () {
test('properties from default project can be parsed', () {
- final String output = '''
+ const String output = '''
Information about project "Runner":
Targets:
Runner
@@ -27,7 +27,7 @@
expect(info.buildConfigurations, <String>['Debug', 'Release']);
});
test('properties from project with custom schemes can be parsed', () {
- final String output = '''
+ const String output = '''
Information about project "Runner":
Targets:
Runner