diff --git a/dev/tools/bin/conductor.dart b/dev/tools/bin/conductor.dart index adafc58022f..97e530ba5da 100644 --- a/dev/tools/bin/conductor.dart +++ b/dev/tools/bin/conductor.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + // See: https://github.com/flutter/flutter/wiki/Release-process import 'dart:io' as io; diff --git a/dev/tools/dartdoc.dart b/dev/tools/dartdoc.dart index ca50839269f..37729c213c1 100644 --- a/dev/tools/dartdoc.dart +++ b/dev/tools/dartdoc.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:convert'; import 'dart:io'; diff --git a/dev/tools/dartdoc_checker.dart b/dev/tools/dartdoc_checker.dart index 57b488edd30..b3bac3c16a5 100644 --- a/dev/tools/dartdoc_checker.dart +++ b/dev/tools/dartdoc_checker.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:io'; import 'package:path/path.dart' as path; diff --git a/dev/tools/find_engine_commit.dart b/dev/tools/find_engine_commit.dart index 8b875539100..c8d67af0c1d 100644 --- a/dev/tools/find_engine_commit.dart +++ b/dev/tools/find_engine_commit.dart @@ -29,7 +29,7 @@ Future main(List args) async { _validate(args); await _fetchUpstream(); await _fetchUpstream(engineRepo); - String flutterRevision; + String? flutterRevision; await for (final FlutterEngineRevision revision in _logEngineVersions()) { if (!await containsRevision(args[0], revision.engineRevision)) { if (flutterRevision == null) { diff --git a/dev/tools/java_and_objc_doc.dart b/dev/tools/java_and_objc_doc.dart index a2043dd4178..21fbd7faae4 100644 --- a/dev/tools/java_and_objc_doc.dart +++ b/dev/tools/java_and_objc_doc.dart @@ -25,8 +25,8 @@ Future main(List args) async { /// Fetches the zip archive at the specified url. /// /// Returns null if the archive fails to download after [maxTries] attempts. -Future fetchArchive(String url, int maxTries) async { - List responseBytes; +Future fetchArchive(String url, int maxTries) async { + List? responseBytes; for (int i = 0; i < maxTries; i++) { final http.Response response = await http.get(Uri.parse(url)); if (response.statusCode == 200) { @@ -45,7 +45,7 @@ Future fetchArchive(String url, int maxTries) async { Future generateDocs(String url, String docName, String checkFile) async { const int maxTries = 5; - final Archive archive = await fetchArchive(url, maxTries); + final Archive? archive = await fetchArchive(url, maxTries); if (archive == null) { stderr.writeln('Failed to fetch zip archive from: $url after $maxTries attempts. Giving up.'); exit(1); diff --git a/dev/tools/lib/clean.dart b/dev/tools/lib/clean.dart index 59e968e5f79..19075573b58 100644 --- a/dev/tools/lib/clean.dart +++ b/dev/tools/lib/clean.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'package:args/command_runner.dart'; import 'package:file/file.dart'; import 'package:meta/meta.dart'; diff --git a/dev/tools/lib/codesign.dart b/dev/tools/lib/codesign.dart index 27f9014e2f5..9b2e547ca0c 100644 --- a/dev/tools/lib/codesign.dart +++ b/dev/tools/lib/codesign.dart @@ -6,7 +6,7 @@ import 'dart:io' as io; import 'package:args/command_runner.dart'; import 'package:file/file.dart'; -import 'package:meta/meta.dart'; +import 'package:meta/meta.dart' show visibleForTesting; import 'package:platform/platform.dart'; import 'package:process/process.dart'; @@ -31,11 +31,10 @@ const String kUpstream = 'upstream'; /// Command to codesign and verify the signatures of cached binaries. class CodesignCommand extends Command { CodesignCommand({ - @required this.checkouts, - @required this.flutterRoot, - FrameworkRepository framework, - }) : assert(flutterRoot != null), - fileSystem = checkouts.fileSystem, + required this.checkouts, + required this.flutterRoot, + FrameworkRepository? framework, + }) : fileSystem = checkouts.fileSystem, platform = checkouts.platform, stdio = checkouts.stdio, processManager = checkouts.processManager { @@ -74,7 +73,7 @@ class CodesignCommand extends Command { /// Root directory of the Flutter repository. final Directory flutterRoot; - FrameworkRepository _framework; + FrameworkRepository? _framework; FrameworkRepository get framework { return _framework ??= FrameworkRepository.localRepoAsUpstream( checkouts, @@ -97,21 +96,21 @@ class CodesignCommand extends Command { '"${platform.operatingSystem}"'); } - if (argResults['verify'] as bool != true) { + if (argResults!['verify'] as bool != true) { throw ConductorException( 'Sorry, but codesigning is not implemented yet. Please pass the ' '--$kVerify flag to verify signatures.'); } String revision; - if (argResults.wasParsed(kRevision)) { + if (argResults!.wasParsed(kRevision)) { stdio.printError( 'Warning! When providing an arbitrary revision, the contents of the cache may not'); stdio.printError( 'match the expected binaries in the conductor tool. It is preferred to check out'); stdio.printError( 'the desired revision and run that version of the conductor.\n'); - revision = argResults[kRevision] as String; + revision = argResults![kRevision] as String; } else { revision = (processManager.runSync( ['git', 'rev-parse', 'HEAD'], @@ -127,7 +126,7 @@ class CodesignCommand extends Command { framework.runFlutter(['precache', '--android', '--ios', '--macos']); verifyExist(); - if (argResults[kSignatures] as bool) { + if (argResults![kSignatures] as bool) { verifySignatures(); } } @@ -319,16 +318,16 @@ class CodesignCommand extends Command { } stdio.printStatus( - 'Verified that binaries for commit ${argResults[kRevision] as String} are codesigned and have ' + 'Verified that binaries for commit ${argResults![kRevision] as String} are codesigned and have ' 'expected entitlements.'); } - List _allBinaryPaths; + List? _allBinaryPaths; /// Find every binary file in the given [rootDirectory]. List findBinaryPaths(String rootDirectory) { if (_allBinaryPaths != null) { - return _allBinaryPaths; + return _allBinaryPaths!; } final io.ProcessResult result = processManager.runSync( [ @@ -343,7 +342,7 @@ class CodesignCommand extends Command { .where((String s) => s.isNotEmpty) .toList(); _allBinaryPaths = allFiles.where(isBinary).toList(); - return _allBinaryPaths; + return _allBinaryPaths!; } /// Check mime-type of file at [filePath] to determine if it is binary. diff --git a/dev/tools/lib/git.dart b/dev/tools/lib/git.dart index caed631b927..41ed5fc9c0c 100644 --- a/dev/tools/lib/git.dart +++ b/dev/tools/lib/git.dart @@ -4,7 +4,6 @@ import 'dart:io'; -import 'package:meta/meta.dart'; import 'package:process/process.dart'; import './globals.dart'; @@ -18,7 +17,7 @@ class Git { String getOutput( List args, String explanation, { - @required String workingDirectory, + required String workingDirectory, bool allowFailures = false, }) { final ProcessResult result = _run(args, workingDirectory); @@ -26,14 +25,13 @@ class Git { return stdoutToString(result.stdout); } _reportFailureAndExit(args, workingDirectory, result, explanation); - return null; // for the analyzer's sake } int run( List args, String explanation, { bool allowNonZeroExitCode = false, - @required String workingDirectory, + required String workingDirectory, }) { final ProcessResult result = _run(args, workingDirectory); if (result.exitCode != 0 && !allowNonZeroExitCode) { @@ -50,7 +48,7 @@ class Git { ); } - void _reportFailureAndExit( + Never _reportFailureAndExit( List args, String workingDirectory, ProcessResult result, diff --git a/dev/tools/lib/globals.dart b/dev/tools/lib/globals.dart index 2234b79ca21..2ab44ca6ebd 100644 --- a/dev/tools/lib/globals.dart +++ b/dev/tools/lib/globals.dart @@ -39,10 +39,10 @@ class ConductorException implements Exception { String toString() => 'Exception: $message'; } -Directory _flutterRoot; +Directory? _flutterRoot; Directory get localFlutterRoot { if (_flutterRoot != null) { - return _flutterRoot; + return _flutterRoot!; } String filePath; const FileSystem fileSystem = LocalFileSystem(); @@ -54,14 +54,14 @@ Directory get localFlutterRoot { r'(file:\/\/[^"]*[/\\]dev\/tools[/\\][^"]+\.dart)', multiLine: true, ); - final Match match = + final Match? match = pattern.firstMatch(Uri.decodeFull(platform.script.path)); if (match == null) { throw Exception( 'Cannot determine path of script!\n${platform.script.path}', ); } - filePath = Uri.parse(match.group(1)).path.replaceAll(r'%20', ' '); + filePath = Uri.parse(match.group(1)!).path.replaceAll(r'%20', ' '); } else { filePath = platform.script.toFilePath(); } @@ -74,7 +74,7 @@ Directory get localFlutterRoot { ), ); _flutterRoot = fileSystem.directory(checkoutsDirname); - return _flutterRoot; + return _flutterRoot!; } bool assertsEnabled() { @@ -102,9 +102,9 @@ String getValueFromEnvOrArgs( ) { final String envName = fromArgToEnvName(name); if (env[envName] != null ) { - return env[envName]; + return env[envName]!; } - final String argValue = argResults[name] as String; + final String? argValue = argResults[name] as String?; if (argValue != null) { return argValue; } @@ -130,7 +130,7 @@ List getValuesFromEnvOrArgs( ) { final String envName = fromArgToEnvName(name); if (env[envName] != null && env[envName] != '') { - return env[envName].split(','); + return env[envName]!.split(','); } final List argValues = argResults[name] as List; if (argValues != null) { diff --git a/dev/tools/lib/repository.dart b/dev/tools/lib/repository.dart index 63ee5c68e0a..33632706a56 100644 --- a/dev/tools/lib/repository.dart +++ b/dev/tools/lib/repository.dart @@ -23,8 +23,8 @@ enum RemoteName { class Remote { const Remote({ - @required RemoteName name, - @required this.url, + required RemoteName name, + required this.url, }) : _name = name; final RemoteName _name; @@ -37,7 +37,6 @@ class Remote { case RemoteName.mirror: return 'mirror'; } - throw ConductorException('Invalid value of _name: $_name'); // For analyzer } /// The URL of the remote. @@ -47,13 +46,13 @@ class Remote { /// A source code repository. abstract class Repository { Repository({ - @required this.name, - @required this.fetchRemote, - @required this.processManager, - @required this.stdio, - @required this.platform, - @required this.fileSystem, - @required this.parentDirectory, + required this.name, + required this.fetchRemote, + required this.processManager, + required this.stdio, + required this.platform, + required this.fileSystem, + required this.parentDirectory, this.initialRef, this.localUpstream = false, this.useExistingCheckout = false, @@ -69,10 +68,10 @@ abstract class Repository { /// /// This value can be null, in which case attempting to publish will lead to /// a [ConductorException]. - final Remote pushRemote; + final Remote? pushRemote; /// The initial ref (branch or commit name) to check out. - final String initialRef; + final String? initialRef; final Git git; final ProcessManager processManager; final Stdio stdio; @@ -84,7 +83,7 @@ abstract class Repository { /// If the repository will be used as an upstream for a test repo. final bool localUpstream; - Directory _checkoutDirectory; + Directory? _checkoutDirectory; /// Directory for the repository checkout. /// @@ -92,23 +91,23 @@ abstract class Repository { /// cloned on the filesystem until this getter is accessed. Directory get checkoutDirectory { if (_checkoutDirectory != null) { - return _checkoutDirectory; + return _checkoutDirectory!; } _checkoutDirectory = parentDirectory.childDirectory(name); - lazilyInitialize(); - return _checkoutDirectory; + lazilyInitialize(_checkoutDirectory!); + return _checkoutDirectory!; } /// Ensure the repository is cloned to disk and initialized with proper state. - void lazilyInitialize() { - if (!useExistingCheckout && _checkoutDirectory.existsSync()) { - stdio.printTrace('Deleting $name from ${_checkoutDirectory.path}...'); - _checkoutDirectory.deleteSync(recursive: true); + void lazilyInitialize(Directory checkoutDirectory) { + if (!useExistingCheckout && checkoutDirectory.existsSync()) { + stdio.printTrace('Deleting $name from ${checkoutDirectory.path}...'); + checkoutDirectory.deleteSync(recursive: true); } - if (!_checkoutDirectory.existsSync()) { + if (!checkoutDirectory.existsSync()) { stdio.printTrace( - 'Cloning $name from ${fetchRemote.url} to ${_checkoutDirectory.path}...', + 'Cloning $name from ${fetchRemote.url} to ${checkoutDirectory.path}...', ); git.run( [ @@ -117,21 +116,21 @@ abstract class Repository { fetchRemote.name, '--', fetchRemote.url, - _checkoutDirectory.path + checkoutDirectory.path ], 'Cloning $name repo', workingDirectory: parentDirectory.path, ); if (pushRemote != null) { git.run( - ['remote', 'add', pushRemote.name, pushRemote.url], - 'Adding remote ${pushRemote.url} as ${pushRemote.name}', - workingDirectory: _checkoutDirectory.path, + ['remote', 'add', pushRemote!.name, pushRemote!.url], + 'Adding remote ${pushRemote!.url} as ${pushRemote!.name}', + workingDirectory: checkoutDirectory.path, ); git.run( - ['fetch', pushRemote.name], - 'Fetching git remote ${pushRemote.name}', - workingDirectory: _checkoutDirectory.path, + ['fetch', pushRemote!.name], + 'Fetching git remote ${pushRemote!.name}', + workingDirectory: checkoutDirectory.path, ); } if (localUpstream) { @@ -141,7 +140,7 @@ abstract class Repository { git.run( ['checkout', channel, '--'], 'check out branch $channel locally', - workingDirectory: _checkoutDirectory.path, + workingDirectory: checkoutDirectory.path, ); } } @@ -151,7 +150,7 @@ abstract class Repository { git.run( ['checkout', '${fetchRemote.name}/$initialRef'], 'Checking out initialRef $initialRef', - workingDirectory: _checkoutDirectory.path, + workingDirectory: checkoutDirectory.path, ); } final String revision = reverseParse('HEAD'); @@ -404,8 +403,8 @@ class FrameworkRepository extends Repository { name: RemoteName.upstream, url: FrameworkRepository.defaultUpstream), bool localUpstream = false, bool useExistingCheckout = false, - String initialRef, - Remote pushRemote, + String? initialRef, + Remote? pushRemote, }) : super( name: name, fetchRemote: fetchRemote, @@ -428,7 +427,7 @@ class FrameworkRepository extends Repository { Checkouts checkouts, { String name = 'framework', bool useExistingCheckout = false, - @required String upstreamPath, + required String upstreamPath, }) { return FrameworkRepository( checkouts, @@ -455,7 +454,7 @@ class FrameworkRepository extends Repository { ); @override - Repository cloneRepository(String cloneName) { + Repository cloneRepository(String? cloneName) { assert(localUpstream); cloneName ??= 'clone-of-$name'; return FrameworkRepository( @@ -529,7 +528,7 @@ class EngineRepository extends Repository { name: RemoteName.upstream, url: EngineRepository.defaultUpstream), bool localUpstream = false, bool useExistingCheckout = false, - Remote pushRemote, + Remote? pushRemote, }) : super( name: name, fetchRemote: fetchRemote, @@ -550,7 +549,7 @@ class EngineRepository extends Repository { static const String defaultBranch = 'master'; @override - Repository cloneRepository(String cloneName) { + Repository cloneRepository(String? cloneName) { assert(localUpstream); cloneName ??= 'clone-of-$name'; return EngineRepository( @@ -571,14 +570,13 @@ enum RepositoryType { class Checkouts { Checkouts({ - @required this.fileSystem, - @required this.platform, - @required this.processManager, - @required this.stdio, - @required Directory parentDirectory, + required this.fileSystem, + required this.platform, + required this.processManager, + required this.stdio, + required Directory parentDirectory, String directoryName = 'flutter_conductor_checkouts', - }) : assert(parentDirectory != null), - directory = parentDirectory.childDirectory(directoryName) { + }) : directory = parentDirectory.childDirectory(directoryName) { if (!directory.existsSync()) { directory.createSync(recursive: true); } diff --git a/dev/tools/lib/roll_dev.dart b/dev/tools/lib/roll_dev.dart index 29b5c582eb3..977d808748f 100644 --- a/dev/tools/lib/roll_dev.dart +++ b/dev/tools/lib/roll_dev.dart @@ -23,10 +23,10 @@ const String kSkipTagging = 'skip-tagging'; /// Create a new dev release without cherry picks. class RollDevCommand extends Command { RollDevCommand({ - @required this.checkouts, - @required this.fileSystem, - @required this.platform, - @required this.stdio, + required this.checkouts, + required this.fileSystem, + required this.platform, + required this.stdio, }) { argParser.addOption( kIncrement, @@ -92,7 +92,7 @@ class RollDevCommand extends Command { @override void run() { rollDev( - argResults: argResults, + argResults: argResults!, repository: FrameworkRepository(checkouts), stdio: stdio, usage: argParser.usage, @@ -105,10 +105,10 @@ class RollDevCommand extends Command { /// Returns true if publishing was successful, else false. @visibleForTesting bool rollDev({ - @required String usage, - @required ArgResults argResults, - @required Stdio stdio, - @required FrameworkRepository repository, + required String usage, + required ArgResults argResults, + required Stdio stdio, + required FrameworkRepository repository, }) { final String remoteName = argResults[kRemoteName] as String; final String level = argResults[kIncrement] as String; diff --git a/dev/tools/lib/start.dart b/dev/tools/lib/start.dart index cffa6a164ea..ff9e06654df 100644 --- a/dev/tools/lib/start.dart +++ b/dev/tools/lib/start.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:convert' show jsonEncode; import 'package:args/command_runner.dart'; diff --git a/dev/tools/lib/state.dart b/dev/tools/lib/state.dart index 76f52a43da9..37d87068614 100644 --- a/dev/tools/lib/state.dart +++ b/dev/tools/lib/state.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'package:platform/platform.dart'; import './globals.dart'; diff --git a/dev/tools/lib/status.dart b/dev/tools/lib/status.dart index 2b6dc422777..3fd454f22e4 100644 --- a/dev/tools/lib/status.dart +++ b/dev/tools/lib/status.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:convert' show jsonDecode; import 'package:args/command_runner.dart'; diff --git a/dev/tools/lib/stdio.dart b/dev/tools/lib/stdio.dart index 83be05107de..a9099965996 100644 --- a/dev/tools/lib/stdio.dart +++ b/dev/tools/lib/stdio.dart @@ -40,10 +40,10 @@ abstract class Stdio { /// A logger that will print out trace messages. class VerboseStdio extends Stdio { VerboseStdio({ - @required this.stdout, - @required this.stderr, - @required this.stdin, - }) : assert(stdout != null), assert(stderr != null), assert(stdin != null); + required this.stdout, + required this.stderr, + required this.stdin, + }); factory VerboseStdio.local() => VerboseStdio( stdout: io.stdout, @@ -81,6 +81,6 @@ class VerboseStdio extends Stdio { @override String readLineSync() { - return stdin.readLineSync(); + return stdin.readLineSync()!; } } diff --git a/dev/tools/lib/version.dart b/dev/tools/lib/version.dart index cd4452480db..6a93beae44e 100644 --- a/dev/tools/lib/version.dart +++ b/dev/tools/lib/version.dart @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:meta/meta.dart'; - /// Possible string formats that `flutter --version` can return. enum VersionType { /// A stable flutter release. /// /// Example: '1.2.3' stable, + /// A pre-stable flutter release. /// /// Example: '1.2.3-4.5.pre' development, + /// A master channel flutter version. /// /// Example: '1.2.3-4.0.pre.10' @@ -30,13 +30,13 @@ final Map versionPatterns = { class Version { Version({ - @required this.x, - @required this.y, - @required this.z, + required this.x, + required this.y, + required this.z, this.m, this.n, this.commits, - @required this.type, + required this.type, }) { switch (type) { case VersionType.stable: @@ -67,11 +67,13 @@ class Version { versionString = versionString.trim(); // stable tag - Match match = versionPatterns[VersionType.stable].firstMatch(versionString); + Match? match = versionPatterns[VersionType.stable]!.firstMatch(versionString); if (match != null) { // parse stable - final List parts = - match.groups([1, 2, 3]).map(int.parse).toList(); + final List parts = match + .groups([1, 2, 3]) + .map((String? s) => int.parse(s!)) + .toList(); return Version( x: parts[0], y: parts[1], @@ -80,11 +82,11 @@ class Version { ); } // development tag - match = versionPatterns[VersionType.development].firstMatch(versionString); + match = versionPatterns[VersionType.development]!.firstMatch(versionString); if (match != null) { // parse development final List parts = - match.groups([1, 2, 3, 4, 5]).map(int.parse).toList(); + match.groups([1, 2, 3, 4, 5]).map((String? s) => int.parse(s!)).toList(); return Version( x: parts[0], y: parts[1], @@ -95,11 +97,14 @@ class Version { ); } // latest tag - match = versionPatterns[VersionType.latest].firstMatch(versionString); + match = versionPatterns[VersionType.latest]!.firstMatch(versionString); if (match != null) { // parse latest - final List parts = - match.groups([1, 2, 3, 4, 5, 6]).map(int.parse).toList(); + final List parts = match.groups( + [1, 2, 3, 4, 5, 6], + ).map( + (String? s) => int.parse(s!), + ).toList(); return Version( x: parts[0], y: parts[1], @@ -118,13 +123,13 @@ class Version { factory Version.increment( Version previousVersion, String increment, { - VersionType nextVersionType, + VersionType? nextVersionType, }) { final int nextX = previousVersion.x; int nextY = previousVersion.y; int nextZ = previousVersion.z; - int nextM = previousVersion.m; - int nextN = previousVersion.n; + int? nextM = previousVersion.m; + int? nextN = previousVersion.n; if (nextVersionType == null) { if (previousVersion.type == VersionType.latest) { nextVersionType = VersionType.development; @@ -137,7 +142,6 @@ class Version { case 'x': // This was probably a mistake. throw Exception('Incrementing x is not supported by this tool.'); - break; case 'y': // Dev release following a beta release. nextY += 1; @@ -155,13 +159,12 @@ class Version { case 'm': // Regular dev release. assert(previousVersion.type == VersionType.development); - assert(nextM != null); - nextM += 1; + nextM = nextM! + 1; nextN = 0; break; case 'n': // Hotfix to internal roll. - nextN += 1; + nextN = nextN! + 1; break; default: throw Exception('Unknown increment level $increment.'); @@ -186,13 +189,13 @@ class Version { final int z; /// Zero-indexed count of dev releases after a beta release. - final int m; + final int? m; /// Number of hotfixes required to make a dev release. - final int n; + final int? n; /// Number of commits past last tagged dev release. - final int commits; + final int? commits; final VersionType type; @@ -206,6 +209,5 @@ class Version { case VersionType.latest: return '$x.$y.$z-$m.$n.pre.$commits'; } - return null; // For analyzer } } diff --git a/dev/tools/localization/bin/encode_kn_arb_files.dart b/dev/tools/localization/bin/encode_kn_arb_files.dart index f974215c544..d2cb20f52b3 100644 --- a/dev/tools/localization/bin/encode_kn_arb_files.dart +++ b/dev/tools/localization/bin/encode_kn_arb_files.dart @@ -13,6 +13,8 @@ // This utility is run by `gen_localizations.dart` if --overwrite is passed // in as an option. +// @dart = 2.8 + import 'dart:convert'; import 'dart:io'; diff --git a/dev/tools/localization/bin/gen_date_localizations.dart b/dev/tools/localization/bin/gen_date_localizations.dart index 5da786a05e3..e361a4fa67a 100644 --- a/dev/tools/localization/bin/gen_date_localizations.dart +++ b/dev/tools/localization/bin/gen_date_localizations.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + /// This program extracts localized date symbols and patterns from the intl /// package for the subset of locales supported by the flutter_localizations /// package. diff --git a/dev/tools/localization/bin/gen_localizations.dart b/dev/tools/localization/bin/gen_localizations.dart index 75a23d82f5c..975c2785173 100644 --- a/dev/tools/localization/bin/gen_localizations.dart +++ b/dev/tools/localization/bin/gen_localizations.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + // This program generates a getMaterialTranslation() and a // getCupertinoTranslation() function that look up the translations provided by // the arb files. The returned value is a generated instance of a diff --git a/dev/tools/localization/bin/gen_missing_localizations.dart b/dev/tools/localization/bin/gen_missing_localizations.dart index d505e659f53..c4ca16252be 100644 --- a/dev/tools/localization/bin/gen_missing_localizations.dart +++ b/dev/tools/localization/bin/gen_missing_localizations.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + // This program updates the language locale arb files with any missing resource // entries that are included in the English arb files. This is useful when // adding new resources for localization. You can just add the appropriate diff --git a/dev/tools/localization/gen_cupertino_localizations.dart b/dev/tools/localization/gen_cupertino_localizations.dart index f93b012354e..e1f4968ea47 100644 --- a/dev/tools/localization/gen_cupertino_localizations.dart +++ b/dev/tools/localization/gen_cupertino_localizations.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'localizations_utils.dart'; String generateCupertinoHeader(String regenerateInstructions) { diff --git a/dev/tools/localization/gen_material_localizations.dart b/dev/tools/localization/gen_material_localizations.dart index 31170cc1b23..528cd8c8ae5 100644 --- a/dev/tools/localization/gen_material_localizations.dart +++ b/dev/tools/localization/gen_material_localizations.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'localizations_utils.dart'; String generateMaterialHeader(String regenerateInstructions) { diff --git a/dev/tools/localization/localizations_utils.dart b/dev/tools/localization/localizations_utils.dart index 63ea14e804e..ae1e4451c9f 100644 --- a/dev/tools/localization/localizations_utils.dart +++ b/dev/tools/localization/localizations_utils.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:convert'; import 'dart:io'; diff --git a/dev/tools/localization/localizations_validator.dart b/dev/tools/localization/localizations_validator.dart index ef0e78bfe59..640320c839a 100644 --- a/dev/tools/localization/localizations_validator.dart +++ b/dev/tools/localization/localizations_validator.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:convert' show json; import 'dart:io'; diff --git a/dev/tools/mega_gallery.dart b/dev/tools/mega_gallery.dart index 8a5d0a54e8f..ee7ddce25f9 100644 --- a/dev/tools/mega_gallery.dart +++ b/dev/tools/mega_gallery.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + /// Make `n` copies of flutter_gallery. import 'dart:io'; diff --git a/dev/tools/pubspec.yaml b/dev/tools/pubspec.yaml index 1b587b0f617..83a691bfa2e 100644 --- a/dev/tools/pubspec.yaml +++ b/dev/tools/pubspec.yaml @@ -2,7 +2,7 @@ name: dev_tools description: Various repository development tools for flutter. environment: - sdk: ">=2.6.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: archive: 3.1.2 diff --git a/dev/tools/test/clean_test.dart b/dev/tools/test/clean_test.dart index 2c84a5767ee..0f6d760078a 100644 --- a/dev/tools/test/clean_test.dart +++ b/dev/tools/test/clean_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'package:args/command_runner.dart'; import 'package:dev_tools/clean.dart'; import 'package:dev_tools/repository.dart'; diff --git a/dev/tools/test/codesign_test.dart b/dev/tools/test/codesign_test.dart index 25c436de1ef..76cbde21f5c 100644 --- a/dev/tools/test/codesign_test.dart +++ b/dev/tools/test/codesign_test.dart @@ -8,7 +8,6 @@ import 'package:dev_tools/globals.dart'; import 'package:dev_tools/repository.dart'; import 'package:file/file.dart'; import 'package:file/memory.dart'; -import 'package:meta/meta.dart'; import 'package:platform/platform.dart'; import '../../../packages/flutter_tools/test/src/fake_process_manager.dart'; @@ -23,12 +22,12 @@ void main() { const String flutterBin = '${checkoutsParentDirectory}flutter_conductor_checkouts/framework/bin/flutter'; const String revision = 'abcd1234'; - CommandRunner runner; - Checkouts checkouts; - MemoryFileSystem fileSystem; - FakePlatform platform; - TestStdio stdio; - FakeProcessManager processManager; + late CommandRunner runner; + late Checkouts checkouts; + late MemoryFileSystem fileSystem; + late FakePlatform platform; + late TestStdio stdio; + late FakeProcessManager processManager; const List binariesWithEntitlements = [ '$flutterCache/dart-sdk/bin/dart', '$flutterCache/dart-sdk/bin/dartaotruntime', @@ -43,7 +42,7 @@ void main() { void createRunner({ String operatingSystem = 'macos', - List commands, + List? commands, }) { stdio = TestStdio(); fileSystem = MemoryFileSystem.test(); @@ -410,10 +409,10 @@ void main() { class FakeCodesignCommand extends CodesignCommand { FakeCodesignCommand({ - @required Checkouts checkouts, - @required this.binariesWithEntitlements, - @required this.binariesWithoutEntitlements, - @required Directory flutterRoot, + required Checkouts checkouts, + required this.binariesWithEntitlements, + required this.binariesWithoutEntitlements, + required Directory flutterRoot, }) : super(checkouts: checkouts, flutterRoot: flutterRoot); @override diff --git a/dev/tools/test/common.dart b/dev/tools/test/common.dart index 306c33cedac..531a03f731c 100644 --- a/dev/tools/test/common.dart +++ b/dev/tools/test/common.dart @@ -38,10 +38,8 @@ Matcher throwsExceptionWith(String messageSubString) { class TestStdio extends Stdio { TestStdio({ this.verbose = false, - List stdin, - }) { - _stdin = stdin ?? []; - } + List? stdin, + }) : _stdin = stdin ?? []; String get error => logs.where((String log) => log.startsWith(r'[error] ')).join('\n'); @@ -50,7 +48,7 @@ class TestStdio extends Stdio { }).join('\n'); final bool verbose; - List _stdin; + late final List _stdin; @override String readLineSync() { @@ -63,9 +61,9 @@ class TestStdio extends Stdio { class FakeArgResults implements ArgResults { FakeArgResults({ - String level, - String commit, - String remote, + required String level, + required String commit, + String remote = 'upstream', bool justPrint = false, bool autoApprove = true, // so we don't have to mock stdin bool help = false, @@ -83,22 +81,26 @@ class FakeArgResults implements ArgResults { }; @override - String name; + String? name; @override - ArgResults command; + ArgResults? command; @override final List rest = []; @override - List arguments; + List get arguments { + assert(false, 'not yet implemented'); + return []; + } final Map _parsedArgs; @override Iterable get options { - return null; + assert(false, 'not yet implemented'); + return []; } @override @@ -108,6 +110,7 @@ class FakeArgResults implements ArgResults { @override bool wasParsed(String name) { - return null; + assert(false, 'not yet implemented'); + return false; } } diff --git a/dev/tools/test/roll_dev_integration_test.dart b/dev/tools/test/roll_dev_integration_test.dart index a13b7f3cc19..f0a8243fec9 100644 --- a/dev/tools/test/roll_dev_integration_test.dart +++ b/dev/tools/test/roll_dev_integration_test.dart @@ -14,16 +14,16 @@ import './common.dart'; void main() { group('roll-dev', () { - TestStdio stdio; - Platform platform; - ProcessManager processManager; - FileSystem fileSystem; + late TestStdio stdio; + late Platform platform; + late ProcessManager processManager; + late FileSystem fileSystem; const String usageString = 'Usage: flutter conductor.'; - Checkouts checkouts; - FrameworkRepository frameworkUpstream; - FrameworkRepository framework; - Directory tempDir; + late Checkouts checkouts; + late FrameworkRepository frameworkUpstream; + late FrameworkRepository framework; + late Directory tempDir; setUp(() { platform = const LocalPlatform(); diff --git a/dev/tools/test/roll_dev_test.dart b/dev/tools/test/roll_dev_test.dart index 2797212c89b..d6e32ac0105 100644 --- a/dev/tools/test/roll_dev_test.dart +++ b/dev/tools/test/roll_dev_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'package:dev_tools/globals.dart'; import 'package:dev_tools/repository.dart'; import 'package:dev_tools/roll_dev.dart'; diff --git a/dev/tools/test/start_test.dart b/dev/tools/test/start_test.dart index 683d9090cfe..6924502cc24 100644 --- a/dev/tools/test/start_test.dart +++ b/dev/tools/test/start_test.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + import 'dart:convert' show jsonDecode; import 'package:args/command_runner.dart'; diff --git a/dev/tools/update_icons.dart b/dev/tools/update_icons.dart index 9ab1f1655ff..d19b9374cc4 100644 --- a/dev/tools/update_icons.dart +++ b/dev/tools/update_icons.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart = 2.8 + // Regenerates the material icons file. // See https://github.com/flutter/flutter/wiki/Updating-Material-Design-Fonts-&-Icons