Skip to content

Commit

Permalink
Change some required nullable parameters in tool to non-null (flutter…
Browse files Browse the repository at this point in the history
  • Loading branch information
jmagman committed Nov 4, 2022
1 parent 48457d7 commit c1d2b85
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
18 changes: 9 additions & 9 deletions packages/flutter_tools/lib/src/commands/precache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import '../runner/flutter_command.dart';
class PrecacheCommand extends FlutterCommand {
PrecacheCommand({
bool verboseHelp = false,
required Cache? cache,
required Cache cache,
required Platform platform,
required Logger logger,
required FeatureFlags featureFlags,
Expand Down Expand Up @@ -58,7 +58,7 @@ class PrecacheCommand extends FlutterCommand {
help: 'Precache the unsigned macOS binaries when available.', hide: !verboseHelp);
}

final Cache? _cache;
final Cache _cache;
final Logger _logger;
final Platform _platform;
final FeatureFlags _featureFlags;
Expand Down Expand Up @@ -133,21 +133,21 @@ class PrecacheCommand extends FlutterCommand {
Future<FlutterCommandResult> runCommand() async {
// Re-lock the cache.
if (_platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true') {
await _cache!.lock();
await _cache.lock();
}
if (boolArgDeprecated('force')) {
_cache!.clearStampFiles();
_cache.clearStampFiles();
}

final bool includeAllPlatforms = boolArgDeprecated('all-platforms');
if (includeAllPlatforms) {
_cache!.includeAllPlatforms = true;
_cache.includeAllPlatforms = true;
}
if (boolArgDeprecated('use-unsigned-mac-binaries')) {
_cache!.useUnsignedMacBinaries = true;
_cache.useUnsignedMacBinaries = true;
}
final Set<String> explicitlyEnabled = _explicitArtifactSelections();
_cache!.platformOverrideArtifacts = explicitlyEnabled;
_cache.platformOverrideArtifacts = explicitlyEnabled;

// If the user did not provide any artifact flags, then download
// all artifacts that correspond to an enabled platform.
Expand All @@ -164,8 +164,8 @@ class PrecacheCommand extends FlutterCommand {
requiredArtifacts.add(artifact);
}
}
if (!await _cache!.isUpToDate()) {
await _cache!.updateAll(requiredArtifacts);
if (!await _cache.isUpToDate()) {
await _cache.updateAll(requiredArtifacts);
} else {
_logger.printStatus('Already up-to-date.');
}
Expand Down
6 changes: 1 addition & 5 deletions packages/flutter_tools/lib/src/ios/code_signing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// project has a development team set in the project's build settings.
Future<Map<String, String>?> getCodeSigningIdentityDevelopmentTeamBuildSetting({
required Map<String, String>? buildSettings,
required Map<String, String> buildSettings,
required ProcessManager processManager,
required Platform platform,
required Logger logger,
required Config config,
required Terminal terminal,
}) async {
if (buildSettings == null) {
return null;
}

// If the user already has it set in the project build settings itself,
// continue with that.
if (_isNotEmpty(buildSettings[_developmentTeamBuildSettingName])) {
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter_tools/lib/src/isolated/devfs_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ const String _kDefaultIndex = '''
/// This is only used in development mode.
class WebExpressionCompiler implements ExpressionCompiler {
WebExpressionCompiler(this._generator, {
required FileSystem? fileSystem,
required FileSystem fileSystem,
}) : _fileSystem = fileSystem;

final ResidentCompiler _generator;
final FileSystem? _fileSystem;
final FileSystem _fileSystem;

@override
Future<ExpressionCompilationResult> compileExpressionToJs(
Expand All @@ -106,7 +106,7 @@ class WebExpressionCompiler implements ExpressionCompiler {

if (compilerOutput != null && compilerOutput.outputFilename != null) {
final String content = utf8.decode(
_fileSystem!.file(compilerOutput.outputFilename).readAsBytesSync());
_fileSystem.file(compilerOutput.outputFilename).readAsBytesSync());
return ExpressionCompilationResult(
content, compilerOutput.errorCount > 0);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter_tools/lib/src/test/flutter_web_goldens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestGoldenComparator {
TestGoldenComparator(this.shellPath, this.compilerFactory, {
required Logger logger,
required FileSystem fileSystem,
required ProcessManager? processManager,
required ProcessManager processManager,
required this.webRenderer,
}) : tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_web_platform.'),
_logger = logger,
Expand All @@ -39,7 +39,7 @@ class TestGoldenComparator {
final TestCompiler Function() compilerFactory;
final Logger _logger;
final FileSystem _fileSystem;
final ProcessManager? _processManager;
final ProcessManager _processManager;
final WebRendererMode webRenderer;

TestCompiler? _compiler;
Expand Down Expand Up @@ -95,7 +95,7 @@ class TestGoldenComparator {
'FLUTTER_TEST_BROWSER': 'chrome',
'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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void main() {

testWithoutContext('No auto-sign if Xcode project settings are not available', () async {
final Map<String, String>? signingConfigs = await getCodeSigningIdentityDevelopmentTeamBuildSetting(
buildSettings: null,
buildSettings: <String, String>{},
processManager: FakeProcessManager.empty(),
platform: macosPlatform,
logger: logger,
Expand Down

0 comments on commit c1d2b85

Please sign in to comment.