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]) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import '../src/context.dart';
|
||||
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);
|
||||
});
|
||||
|
||||
@@ -130,7 +130,7 @@ $fontsSection
|
||||
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 @@ $fontsSection
|
||||
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 @@ $fontsSection
|
||||
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 @@ $fontsSection
|
||||
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 @@ $fontsSection
|
||||
|
||||
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: fontsSection,
|
||||
);
|
||||
|
||||
final String font = 'a/bar';
|
||||
const String font = 'a/bar';
|
||||
writeFontAsset('p/p/', font);
|
||||
|
||||
final String expectedFontManifest =
|
||||
@@ -216,7 +216,7 @@ $fontsSection
|
||||
|
||||
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 @@ $fontsSection
|
||||
);
|
||||
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 @@ $fontsSection
|
||||
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 @@ $fontsSection
|
||||
'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 @@ $fontsSection
|
||||
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: fontsSection,
|
||||
);
|
||||
|
||||
final String font = 'a/bar';
|
||||
const String font = 'a/bar';
|
||||
writeFontAsset('', font);
|
||||
writeFontAsset('p/p/', font);
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ $assetsSection
|
||||
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 @@ $assetsSection
|
||||
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,
|
||||
|
||||
@@ -56,8 +56,8 @@ void main() {
|
||||
// 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 @@ void main() {
|
||||
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,
|
||||
|
||||
@@ -34,7 +34,7 @@ void main() {
|
||||
/// 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 @@ void main() {
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ void main() {
|
||||
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;
|
||||
|
||||
@@ -186,7 +186,7 @@ void main() {
|
||||
});
|
||||
|
||||
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>();
|
||||
|
||||
@@ -27,7 +27,7 @@ void main() {
|
||||
});
|
||||
|
||||
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 @@ dependencies:
|
||||
});
|
||||
|
||||
test('knows if material design is used', () async {
|
||||
final String manifest = '''
|
||||
const String manifest = '''
|
||||
name: test
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -57,7 +57,7 @@ flutter:
|
||||
});
|
||||
|
||||
test('has two assets', () async {
|
||||
final String manifest = '''
|
||||
const String manifest = '''
|
||||
name: test
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -75,7 +75,7 @@ flutter:
|
||||
});
|
||||
|
||||
test('has one font family with one asset', () async {
|
||||
final String manifest = '''
|
||||
const String manifest = '''
|
||||
name: test
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -93,7 +93,7 @@ flutter:
|
||||
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 @@ flutter:
|
||||
});
|
||||
|
||||
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 @@ flutter:
|
||||
''';
|
||||
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 @@ flutter:
|
||||
});
|
||||
|
||||
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 @@ flutter:
|
||||
''';
|
||||
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 @@ flutter:
|
||||
});
|
||||
|
||||
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 @@ flutter:
|
||||
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 @@ flutter:
|
||||
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 @@ flutter:
|
||||
});
|
||||
|
||||
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 @@ flutter:
|
||||
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 @@ flutter:
|
||||
});
|
||||
|
||||
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 @@ flutter:
|
||||
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 @@ flutter:
|
||||
});
|
||||
|
||||
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 @@ flutter:
|
||||
''';
|
||||
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);
|
||||
|
||||
@@ -113,7 +113,7 @@ void main() {
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||
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 @@ Information about project "Runner":
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user