Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit c1d2b85

Browse files
authored
Change some required nullable parameters in tool to non-null (#114115)
1 parent 48457d7 commit c1d2b85

File tree

5 files changed

+17
-21
lines changed

5 files changed

+17
-21
lines changed

packages/flutter_tools/lib/src/commands/precache.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import '../runner/flutter_command.dart';
1414
class PrecacheCommand extends FlutterCommand {
1515
PrecacheCommand({
1616
bool verboseHelp = false,
17-
required Cache? cache,
17+
required Cache cache,
1818
required Platform platform,
1919
required Logger logger,
2020
required FeatureFlags featureFlags,
@@ -58,7 +58,7 @@ class PrecacheCommand extends FlutterCommand {
5858
help: 'Precache the unsigned macOS binaries when available.', hide: !verboseHelp);
5959
}
6060

61-
final Cache? _cache;
61+
final Cache _cache;
6262
final Logger _logger;
6363
final Platform _platform;
6464
final FeatureFlags _featureFlags;
@@ -133,21 +133,21 @@ class PrecacheCommand extends FlutterCommand {
133133
Future<FlutterCommandResult> runCommand() async {
134134
// Re-lock the cache.
135135
if (_platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true') {
136-
await _cache!.lock();
136+
await _cache.lock();
137137
}
138138
if (boolArgDeprecated('force')) {
139-
_cache!.clearStampFiles();
139+
_cache.clearStampFiles();
140140
}
141141

142142
final bool includeAllPlatforms = boolArgDeprecated('all-platforms');
143143
if (includeAllPlatforms) {
144-
_cache!.includeAllPlatforms = true;
144+
_cache.includeAllPlatforms = true;
145145
}
146146
if (boolArgDeprecated('use-unsigned-mac-binaries')) {
147-
_cache!.useUnsignedMacBinaries = true;
147+
_cache.useUnsignedMacBinaries = true;
148148
}
149149
final Set<String> explicitlyEnabled = _explicitArtifactSelections();
150-
_cache!.platformOverrideArtifacts = explicitlyEnabled;
150+
_cache.platformOverrideArtifacts = explicitlyEnabled;
151151

152152
// If the user did not provide any artifact flags, then download
153153
// all artifacts that correspond to an enabled platform.
@@ -164,8 +164,8 @@ class PrecacheCommand extends FlutterCommand {
164164
requiredArtifacts.add(artifact);
165165
}
166166
}
167-
if (!await _cache!.isUpToDate()) {
168-
await _cache!.updateAll(requiredArtifacts);
167+
if (!await _cache.isUpToDate()) {
168+
await _cache.updateAll(requiredArtifacts);
169169
} else {
170170
_logger.printStatus('Already up-to-date.');
171171
}

packages/flutter_tools/lib/src/ios/code_signing.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,13 @@ final RegExp _certificateOrganizationalUnitExtractionPattern = RegExp(r'OU=([a-z
9797
/// Will return null if none are found, if the user cancels or if the Xcode
9898
/// project has a development team set in the project's build settings.
9999
Future<Map<String, String>?> getCodeSigningIdentityDevelopmentTeamBuildSetting({
100-
required Map<String, String>? buildSettings,
100+
required Map<String, String> buildSettings,
101101
required ProcessManager processManager,
102102
required Platform platform,
103103
required Logger logger,
104104
required Config config,
105105
required Terminal terminal,
106106
}) async {
107-
if (buildSettings == null) {
108-
return null;
109-
}
110-
111107
// If the user already has it set in the project build settings itself,
112108
// continue with that.
113109
if (_isNotEmpty(buildSettings[_developmentTeamBuildSettingName])) {

packages/flutter_tools/lib/src/isolated/devfs_web.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ const String _kDefaultIndex = '''
8383
/// This is only used in development mode.
8484
class WebExpressionCompiler implements ExpressionCompiler {
8585
WebExpressionCompiler(this._generator, {
86-
required FileSystem? fileSystem,
86+
required FileSystem fileSystem,
8787
}) : _fileSystem = fileSystem;
8888

8989
final ResidentCompiler _generator;
90-
final FileSystem? _fileSystem;
90+
final FileSystem _fileSystem;
9191

9292
@override
9393
Future<ExpressionCompilationResult> compileExpressionToJs(
@@ -106,7 +106,7 @@ class WebExpressionCompiler implements ExpressionCompiler {
106106

107107
if (compilerOutput != null && compilerOutput.outputFilename != null) {
108108
final String content = utf8.decode(
109-
_fileSystem!.file(compilerOutput.outputFilename).readAsBytesSync());
109+
_fileSystem.file(compilerOutput.outputFilename).readAsBytesSync());
110110
return ExpressionCompilationResult(
111111
content, compilerOutput.errorCount > 0);
112112
}

packages/flutter_tools/lib/src/test/flutter_web_goldens.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class TestGoldenComparator {
2727
TestGoldenComparator(this.shellPath, this.compilerFactory, {
2828
required Logger logger,
2929
required FileSystem fileSystem,
30-
required ProcessManager? processManager,
30+
required ProcessManager processManager,
3131
required this.webRenderer,
3232
}) : tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_web_platform.'),
3333
_logger = logger,
@@ -39,7 +39,7 @@ class TestGoldenComparator {
3939
final TestCompiler Function() compilerFactory;
4040
final Logger _logger;
4141
final FileSystem _fileSystem;
42-
final ProcessManager? _processManager;
42+
final ProcessManager _processManager;
4343
final WebRendererMode webRenderer;
4444

4545
TestCompiler? _compiler;
@@ -95,7 +95,7 @@ class TestGoldenComparator {
9595
'FLUTTER_TEST_BROWSER': 'chrome',
9696
'FLUTTER_WEB_RENDERER': webRenderer == WebRendererMode.html ? 'html' : 'canvaskit',
9797
};
98-
return _processManager!.start(command, environment: environment);
98+
return _processManager.start(command, environment: environment);
9999
}
100100

101101
Future<String?> compareGoldens(Uri testUri, Uint8List bytes, Uri goldenKey, bool? updateGoldens) async {

packages/flutter_tools/test/general.shard/ios/code_signing_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void main() {
3939

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

0 commit comments

Comments
 (0)