Unverified Commit c1d2b854 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Change some required nullable parameters in tool to non-null (#114115)

parent 48457d73
...@@ -14,7 +14,7 @@ import '../runner/flutter_command.dart'; ...@@ -14,7 +14,7 @@ import '../runner/flutter_command.dart';
class PrecacheCommand extends FlutterCommand { class PrecacheCommand extends FlutterCommand {
PrecacheCommand({ PrecacheCommand({
bool verboseHelp = false, bool verboseHelp = false,
required Cache? cache, required Cache cache,
required Platform platform, required Platform platform,
required Logger logger, required Logger logger,
required FeatureFlags featureFlags, required FeatureFlags featureFlags,
...@@ -58,7 +58,7 @@ class PrecacheCommand extends FlutterCommand { ...@@ -58,7 +58,7 @@ class PrecacheCommand extends FlutterCommand {
help: 'Precache the unsigned macOS binaries when available.', hide: !verboseHelp); help: 'Precache the unsigned macOS binaries when available.', hide: !verboseHelp);
} }
final Cache? _cache; final Cache _cache;
final Logger _logger; final Logger _logger;
final Platform _platform; final Platform _platform;
final FeatureFlags _featureFlags; final FeatureFlags _featureFlags;
...@@ -133,21 +133,21 @@ class PrecacheCommand extends FlutterCommand { ...@@ -133,21 +133,21 @@ class PrecacheCommand extends FlutterCommand {
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
// Re-lock the cache. // Re-lock the cache.
if (_platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true') { if (_platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true') {
await _cache!.lock(); await _cache.lock();
} }
if (boolArgDeprecated('force')) { if (boolArgDeprecated('force')) {
_cache!.clearStampFiles(); _cache.clearStampFiles();
} }
final bool includeAllPlatforms = boolArgDeprecated('all-platforms'); final bool includeAllPlatforms = boolArgDeprecated('all-platforms');
if (includeAllPlatforms) { if (includeAllPlatforms) {
_cache!.includeAllPlatforms = true; _cache.includeAllPlatforms = true;
} }
if (boolArgDeprecated('use-unsigned-mac-binaries')) { if (boolArgDeprecated('use-unsigned-mac-binaries')) {
_cache!.useUnsignedMacBinaries = true; _cache.useUnsignedMacBinaries = true;
} }
final Set<String> explicitlyEnabled = _explicitArtifactSelections(); final Set<String> explicitlyEnabled = _explicitArtifactSelections();
_cache!.platformOverrideArtifacts = explicitlyEnabled; _cache.platformOverrideArtifacts = explicitlyEnabled;
// If the user did not provide any artifact flags, then download // If the user did not provide any artifact flags, then download
// all artifacts that correspond to an enabled platform. // all artifacts that correspond to an enabled platform.
...@@ -164,8 +164,8 @@ class PrecacheCommand extends FlutterCommand { ...@@ -164,8 +164,8 @@ class PrecacheCommand extends FlutterCommand {
requiredArtifacts.add(artifact); requiredArtifacts.add(artifact);
} }
} }
if (!await _cache!.isUpToDate()) { if (!await _cache.isUpToDate()) {
await _cache!.updateAll(requiredArtifacts); await _cache.updateAll(requiredArtifacts);
} else { } else {
_logger.printStatus('Already up-to-date.'); _logger.printStatus('Already up-to-date.');
} }
......
...@@ -97,17 +97,13 @@ final RegExp _certificateOrganizationalUnitExtractionPattern = RegExp(r'OU=([a-z ...@@ -97,17 +97,13 @@ final RegExp _certificateOrganizationalUnitExtractionPattern = RegExp(r'OU=([a-z
/// Will return null if none are found, if the user cancels or if the Xcode /// Will return null if none are found, if the user cancels or if the Xcode
/// project has a development team set in the project's build settings. /// project has a development team set in the project's build settings.
Future<Map<String, String>?> getCodeSigningIdentityDevelopmentTeamBuildSetting({ Future<Map<String, String>?> getCodeSigningIdentityDevelopmentTeamBuildSetting({
required Map<String, String>? buildSettings, required Map<String, String> buildSettings,
required ProcessManager processManager, required ProcessManager processManager,
required Platform platform, required Platform platform,
required Logger logger, required Logger logger,
required Config config, required Config config,
required Terminal terminal, required Terminal terminal,
}) async { }) async {
if (buildSettings == null) {
return null;
}
// If the user already has it set in the project build settings itself, // If the user already has it set in the project build settings itself,
// continue with that. // continue with that.
if (_isNotEmpty(buildSettings[_developmentTeamBuildSettingName])) { if (_isNotEmpty(buildSettings[_developmentTeamBuildSettingName])) {
......
...@@ -83,11 +83,11 @@ const String _kDefaultIndex = ''' ...@@ -83,11 +83,11 @@ const String _kDefaultIndex = '''
/// This is only used in development mode. /// This is only used in development mode.
class WebExpressionCompiler implements ExpressionCompiler { class WebExpressionCompiler implements ExpressionCompiler {
WebExpressionCompiler(this._generator, { WebExpressionCompiler(this._generator, {
required FileSystem? fileSystem, required FileSystem fileSystem,
}) : _fileSystem = fileSystem; }) : _fileSystem = fileSystem;
final ResidentCompiler _generator; final ResidentCompiler _generator;
final FileSystem? _fileSystem; final FileSystem _fileSystem;
@override @override
Future<ExpressionCompilationResult> compileExpressionToJs( Future<ExpressionCompilationResult> compileExpressionToJs(
...@@ -106,7 +106,7 @@ class WebExpressionCompiler implements ExpressionCompiler { ...@@ -106,7 +106,7 @@ class WebExpressionCompiler implements ExpressionCompiler {
if (compilerOutput != null && compilerOutput.outputFilename != null) { if (compilerOutput != null && compilerOutput.outputFilename != null) {
final String content = utf8.decode( final String content = utf8.decode(
_fileSystem!.file(compilerOutput.outputFilename).readAsBytesSync()); _fileSystem.file(compilerOutput.outputFilename).readAsBytesSync());
return ExpressionCompilationResult( return ExpressionCompilationResult(
content, compilerOutput.errorCount > 0); content, compilerOutput.errorCount > 0);
} }
......
...@@ -27,7 +27,7 @@ class TestGoldenComparator { ...@@ -27,7 +27,7 @@ class TestGoldenComparator {
TestGoldenComparator(this.shellPath, this.compilerFactory, { TestGoldenComparator(this.shellPath, this.compilerFactory, {
required Logger logger, required Logger logger,
required FileSystem fileSystem, required FileSystem fileSystem,
required ProcessManager? processManager, required ProcessManager processManager,
required this.webRenderer, required this.webRenderer,
}) : tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_web_platform.'), }) : tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_web_platform.'),
_logger = logger, _logger = logger,
...@@ -39,7 +39,7 @@ class TestGoldenComparator { ...@@ -39,7 +39,7 @@ class TestGoldenComparator {
final TestCompiler Function() compilerFactory; final TestCompiler Function() compilerFactory;
final Logger _logger; final Logger _logger;
final FileSystem _fileSystem; final FileSystem _fileSystem;
final ProcessManager? _processManager; final ProcessManager _processManager;
final WebRendererMode webRenderer; final WebRendererMode webRenderer;
TestCompiler? _compiler; TestCompiler? _compiler;
...@@ -95,7 +95,7 @@ class TestGoldenComparator { ...@@ -95,7 +95,7 @@ class TestGoldenComparator {
'FLUTTER_TEST_BROWSER': 'chrome', 'FLUTTER_TEST_BROWSER': 'chrome',
'FLUTTER_WEB_RENDERER': webRenderer == WebRendererMode.html ? 'html' : 'canvaskit', 'FLUTTER_WEB_RENDERER': webRenderer == WebRendererMode.html ? 'html' : 'canvaskit',
}; };
return _processManager!.start(command, environment: environment); return _processManager.start(command, environment: environment);
} }
Future<String?> compareGoldens(Uri testUri, Uint8List bytes, Uri goldenKey, bool? updateGoldens) async { Future<String?> compareGoldens(Uri testUri, Uint8List bytes, Uri goldenKey, bool? updateGoldens) async {
......
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
testWithoutContext('No auto-sign if Xcode project settings are not available', () async { testWithoutContext('No auto-sign if Xcode project settings are not available', () async {
final Map<String, String>? signingConfigs = await getCodeSigningIdentityDevelopmentTeamBuildSetting( final Map<String, String>? signingConfigs = await getCodeSigningIdentityDevelopmentTeamBuildSetting(
buildSettings: null, buildSettings: <String, String>{},
processManager: FakeProcessManager.empty(), processManager: FakeProcessManager.empty(),
platform: macosPlatform, platform: macosPlatform,
logger: logger, logger: logger,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment