mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Null aware elements clean-ups (#173074)
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> Converted more null checks to null aware elements. The analyzer had many false negatives and the regex became pretty wild to find many of them 😂 I've found more in the engine folder but I'll apply the changes in a separate PR Part of #172188 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit is contained in:
parent
ef76a61283
commit
f26eddba00
@ -89,7 +89,7 @@ class ABTest {
|
||||
kBenchmarkTypeKeyName: kBenchmarkResultsType,
|
||||
kBenchmarkVersionKeyName: kBenchmarkABVersion,
|
||||
kLocalEngineKeyName: localEngine,
|
||||
if (localEngineHost != null) kLocalEngineHostKeyName: localEngineHost,
|
||||
kLocalEngineHostKeyName: ?localEngineHost,
|
||||
kTaskNameKeyName: taskName,
|
||||
kRunStartKeyName: runStart.toIso8601String(),
|
||||
kRunEndKeyName: runEnd!.toIso8601String(),
|
||||
|
||||
@ -199,7 +199,7 @@ Future<TaskResult> runTask(
|
||||
taskExecutable,
|
||||
...?taskArgs,
|
||||
],
|
||||
environment: <String, String>{if (deviceId != null) DeviceIdEnvName: deviceId},
|
||||
environment: <String, String>{DeviceIdEnvName: ?deviceId},
|
||||
);
|
||||
|
||||
bool runnerFinished = false;
|
||||
|
||||
@ -1647,11 +1647,11 @@ abstract class DiagnosticsNode {
|
||||
result = <String, Object?>{
|
||||
'description': toDescription(),
|
||||
'type': runtimeType.toString(),
|
||||
if (name != null) 'name': name,
|
||||
'name': ?name,
|
||||
if (!showSeparator) 'showSeparator': showSeparator,
|
||||
if (level != DiagnosticLevel.info) 'level': level.name,
|
||||
if (!showName) 'showName': showName,
|
||||
if (emptyBodyDescription != null) 'emptyBodyDescription': emptyBodyDescription,
|
||||
'emptyBodyDescription': ?emptyBodyDescription,
|
||||
if (style != DiagnosticsTreeStyle.sparse) 'style': style!.name,
|
||||
if (allowTruncate) 'allowTruncate': allowTruncate,
|
||||
if (hasChildren) 'hasChildren': hasChildren,
|
||||
|
||||
@ -733,7 +733,7 @@ class AutofillConfiguration {
|
||||
'uniqueIdentifier': uniqueIdentifier,
|
||||
'hints': autofillHints,
|
||||
'editingValue': currentEditingValue.toJSON(),
|
||||
if (hintText != null) 'hintText': hintText,
|
||||
'hintText': ?hintText,
|
||||
}
|
||||
: null;
|
||||
}
|
||||
|
||||
@ -1312,11 +1312,11 @@ abstract class _AndroidViewControllerInternals {
|
||||
'viewType': viewType,
|
||||
'direction': AndroidViewController._getAndroidDirection(layoutDirection),
|
||||
if (hybrid) 'hybrid': hybrid,
|
||||
if (size != null) 'width': size.width,
|
||||
if (size != null) 'height': size.height,
|
||||
'width': ?size?.width,
|
||||
'height': ?size?.height,
|
||||
if (hybridFallback) 'hybridFallback': hybridFallback,
|
||||
if (position != null) 'left': position.dx,
|
||||
if (position != null) 'top': position.dy,
|
||||
'left': ?position?.dx,
|
||||
'top': ?position?.dy,
|
||||
};
|
||||
if (creationParams != null) {
|
||||
final ByteData paramsByteData = creationParams.codec.encodeMessage(creationParams.data)!;
|
||||
|
||||
@ -791,7 +791,7 @@ class TextInputConfiguration {
|
||||
'keyboardAppearance': keyboardAppearance.toString(),
|
||||
'enableIMEPersonalizedLearning': enableIMEPersonalizedLearning,
|
||||
'contentCommitMimeTypes': allowedMimeTypes,
|
||||
if (autofill != null) 'autofill': autofill,
|
||||
'autofill': ?autofill,
|
||||
'enableDeltaModel': enableDeltaModel,
|
||||
'hintLocales': hintLocales?.map((Locale locale) => locale.toLanguageTag()).toList(),
|
||||
};
|
||||
@ -2866,11 +2866,7 @@ sealed class IOSSystemContextMenuItemData {
|
||||
/// Returns json for use in method channel calls, specifically
|
||||
/// `ContextMenu.showSystemContextMenu`.
|
||||
Map<String, dynamic> get _json {
|
||||
return <String, dynamic>{
|
||||
'callbackId': hashCode,
|
||||
if (title != null) 'title': title,
|
||||
'type': _jsonType,
|
||||
};
|
||||
return <String, dynamic>{'callbackId': hashCode, 'title': ?title, 'type': _jsonType};
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -4074,12 +4074,7 @@ class _Location {
|
||||
final String? name;
|
||||
|
||||
Map<String, Object?> toJsonMap() {
|
||||
return <String, Object?>{
|
||||
'file': file,
|
||||
'line': line,
|
||||
'column': column,
|
||||
if (name != null) 'name': name,
|
||||
};
|
||||
return <String, Object?>{'file': file, 'line': line, 'column': column, 'name': ?name};
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -24,7 +24,7 @@ class RequestData extends Command {
|
||||
|
||||
@override
|
||||
Map<String, String> serialize() =>
|
||||
super.serialize()..addAll(<String, String>{if (message != null) 'message': message!});
|
||||
super.serialize()..addAll(<String, String>{'message': ?message});
|
||||
}
|
||||
|
||||
/// The result of the [RequestData] command.
|
||||
|
||||
@ -152,7 +152,7 @@ class Java {
|
||||
/// This map should be used as the environment when invoking any Java-dependent
|
||||
/// processes, such as Gradle or Android SDK tools (avdmanager, sdkmanager, etc.)
|
||||
Map<String, String> get environment => <String, String>{
|
||||
if (javaHome != null) javaHomeEnvironmentVariable: javaHome!,
|
||||
javaHomeEnvironmentVariable: ?javaHome,
|
||||
'PATH':
|
||||
_fileSystem.path.dirname(binaryPath) +
|
||||
_os.pathVarSeparator +
|
||||
|
||||
@ -313,18 +313,18 @@ class BuildInfo {
|
||||
kBuildMode: mode.cliName,
|
||||
if (dartDefines.isNotEmpty) kDartDefines: encodeDartDefines(dartDefines),
|
||||
kDartObfuscation: dartObfuscation.toString(),
|
||||
if (frontendServerStarterPath != null) kFrontendServerStarterPath: frontendServerStarterPath!,
|
||||
kFrontendServerStarterPath: ?frontendServerStarterPath,
|
||||
if (extraFrontEndOptions.isNotEmpty) kExtraFrontEndOptions: extraFrontEndOptions.join(','),
|
||||
if (extraGenSnapshotOptions.isNotEmpty)
|
||||
kExtraGenSnapshotOptions: extraGenSnapshotOptions.join(','),
|
||||
if (splitDebugInfoPath != null) kSplitDebugInfo: splitDebugInfoPath!,
|
||||
kSplitDebugInfo: ?splitDebugInfoPath,
|
||||
kTrackWidgetCreation: trackWidgetCreation.toString(),
|
||||
kIconTreeShakerFlag: treeShakeIcons.toString(),
|
||||
if (codeSizeDirectory != null) kCodeSizeDirectory: codeSizeDirectory!,
|
||||
kCodeSizeDirectory: ?codeSizeDirectory,
|
||||
if (fileSystemRoots.isNotEmpty) kFileSystemRoots: fileSystemRoots.join(','),
|
||||
if (fileSystemScheme != null) kFileSystemScheme: fileSystemScheme!,
|
||||
if (buildName != null) kBuildName: buildName!,
|
||||
if (buildNumber != null) kBuildNumber: buildNumber!,
|
||||
kFileSystemScheme: ?fileSystemScheme,
|
||||
kBuildName: ?buildName,
|
||||
kBuildNumber: ?buildNumber,
|
||||
if (useLocalCanvasKit) kUseLocalCanvasKitFlag: useLocalCanvasKit.toString(),
|
||||
};
|
||||
}
|
||||
@ -343,14 +343,14 @@ class BuildInfo {
|
||||
'EXTRA_FRONT_END_OPTIONS': extraFrontEndOptions.join(','),
|
||||
if (extraGenSnapshotOptions.isNotEmpty)
|
||||
'EXTRA_GEN_SNAPSHOT_OPTIONS': extraGenSnapshotOptions.join(','),
|
||||
if (splitDebugInfoPath != null) 'SPLIT_DEBUG_INFO': splitDebugInfoPath!,
|
||||
'SPLIT_DEBUG_INFO': ?splitDebugInfoPath,
|
||||
'TRACK_WIDGET_CREATION': trackWidgetCreation.toString(),
|
||||
'TREE_SHAKE_ICONS': treeShakeIcons.toString(),
|
||||
if (performanceMeasurementFile != null)
|
||||
'PERFORMANCE_MEASUREMENT_FILE': performanceMeasurementFile!,
|
||||
'PACKAGE_CONFIG': packageConfigPath,
|
||||
if (codeSizeDirectory != null) 'CODE_SIZE_DIRECTORY': codeSizeDirectory!,
|
||||
if (flavor != null) 'FLAVOR': flavor!,
|
||||
'CODE_SIZE_DIRECTORY': ?codeSizeDirectory,
|
||||
'FLAVOR': ?flavor,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -227,7 +227,7 @@ abstract class Target {
|
||||
'dependencies': <String>[for (final Target target in dependencies) target.name],
|
||||
'inputs': <String>[for (final File file in resolveInputs(environment).sources) file.path],
|
||||
'outputs': <String>[for (final File file in resolveOutputs(environment).sources) file.path],
|
||||
if (key != null) 'buildKey': key,
|
||||
'buildKey': ?key,
|
||||
'stamp': _findStampFile(environment).absolute.path,
|
||||
};
|
||||
}
|
||||
|
||||
@ -1824,7 +1824,7 @@ final class MachineOutputLogger extends DelegatingLogger {
|
||||
final event = <String, Object?>{
|
||||
'id': eventId,
|
||||
'progressId': eventType,
|
||||
if (message != null) 'message': message,
|
||||
'message': ?message,
|
||||
'finished': finished,
|
||||
};
|
||||
|
||||
|
||||
@ -282,11 +282,7 @@ class DaemonConnection {
|
||||
final id = '${++_outgoingRequestId}';
|
||||
final completer = Completer<Object?>();
|
||||
_outgoingRequestCompleters[id] = completer;
|
||||
final data = <String, Object?>{
|
||||
'id': id,
|
||||
'method': method,
|
||||
if (params != null) 'params': params,
|
||||
};
|
||||
final data = <String, Object?>{'id': id, 'method': method, 'params': ?params};
|
||||
_logger.printTrace('-> Sending to daemon, id = $id, method = $method');
|
||||
_daemonStreams.send(data, binary);
|
||||
return completer.future;
|
||||
@ -294,7 +290,7 @@ class DaemonConnection {
|
||||
|
||||
/// Sends a response to the other end of the connection.
|
||||
void sendResponse(Object id, [Object? result]) {
|
||||
_daemonStreams.send(<String, Object?>{'id': id, if (result != null) 'result': result});
|
||||
_daemonStreams.send(<String, Object?>{'id': id, 'result': ?result});
|
||||
}
|
||||
|
||||
/// Sends an error response to the other end of the connection.
|
||||
@ -304,10 +300,7 @@ class DaemonConnection {
|
||||
|
||||
/// Sends an event to the client.
|
||||
void sendEvent(String name, [Object? params, List<int>? binary]) {
|
||||
_daemonStreams.send(<String, Object?>{
|
||||
'event': name,
|
||||
if (params != null) 'params': params,
|
||||
}, binary);
|
||||
_daemonStreams.send(<String, Object?>{'event': name, 'params': ?params}, binary);
|
||||
}
|
||||
|
||||
/// Handles the input from the stream.
|
||||
|
||||
@ -81,10 +81,10 @@ class FlutterAttachRequestArguments extends DartCommonLaunchAttachRequestArgumen
|
||||
@override
|
||||
Map<String, Object?> toJson() => <String, Object?>{
|
||||
...super.toJson(),
|
||||
if (toolArgs != null) 'toolArgs': toolArgs,
|
||||
if (customTool != null) 'customTool': customTool,
|
||||
if (customToolReplacesArgs != null) 'customToolReplacesArgs': customToolReplacesArgs,
|
||||
if (vmServiceUri != null) 'vmServiceUri': vmServiceUri,
|
||||
'toolArgs': ?toolArgs,
|
||||
'customTool': ?customTool,
|
||||
'customToolReplacesArgs': ?customToolReplacesArgs,
|
||||
'vmServiceUri': ?vmServiceUri,
|
||||
};
|
||||
}
|
||||
|
||||
@ -162,11 +162,11 @@ class FlutterLaunchRequestArguments extends DartCommonLaunchAttachRequestArgumen
|
||||
@override
|
||||
Map<String, Object?> toJson() => <String, Object?>{
|
||||
...super.toJson(),
|
||||
if (noDebug != null) 'noDebug': noDebug,
|
||||
if (program != null) 'program': program,
|
||||
if (args != null) 'args': args,
|
||||
if (toolArgs != null) 'toolArgs': toolArgs,
|
||||
if (customTool != null) 'customTool': customTool,
|
||||
if (customToolReplacesArgs != null) 'customToolReplacesArgs': customToolReplacesArgs,
|
||||
'noDebug': ?noDebug,
|
||||
'program': ?program,
|
||||
'args': ?args,
|
||||
'toolArgs': ?toolArgs,
|
||||
'customTool': ?customTool,
|
||||
'customToolReplacesArgs': ?customToolReplacesArgs,
|
||||
};
|
||||
}
|
||||
|
||||
@ -352,8 +352,8 @@ Map<String, dynamic> getDesiredCapabilities(
|
||||
'v8,blink.console,benchmark,blink,'
|
||||
'blink.user_timing',
|
||||
},
|
||||
if (chromeBinary != null) 'binary': chromeBinary,
|
||||
if (mobileEmulation != null) 'mobileEmulation': mobileEmulation,
|
||||
'binary': ?chromeBinary,
|
||||
'mobileEmulation': ?mobileEmulation,
|
||||
},
|
||||
},
|
||||
Browser.firefox => <String, dynamic>{
|
||||
|
||||
@ -166,12 +166,12 @@ class AndroidPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
Map<String, dynamic> toMap() {
|
||||
return <String, dynamic>{
|
||||
'name': name,
|
||||
if (package != null) 'package': package,
|
||||
if (pluginClass != null) 'class': pluginClass,
|
||||
if (dartPluginClass != null) kDartPluginClass: dartPluginClass,
|
||||
if (dartFileName != null) kDartFileName: dartFileName,
|
||||
'package': ?package,
|
||||
'class': ?pluginClass,
|
||||
kDartPluginClass: ?dartPluginClass,
|
||||
kDartFileName: ?dartFileName,
|
||||
if (ffiPlugin) kFfiPlugin: true,
|
||||
if (defaultPackage != null) kDefaultPackage: defaultPackage,
|
||||
kDefaultPackage: ?defaultPackage,
|
||||
// Mustache doesn't support complex types.
|
||||
'supportsEmbeddingV1': _supportedEmbeddings.contains('1'),
|
||||
'supportsEmbeddingV2': _supportedEmbeddings.contains('2'),
|
||||
@ -326,12 +326,12 @@ class IOSPlugin extends PluginPlatform implements NativeOrDartPlugin, DarwinPlug
|
||||
return <String, dynamic>{
|
||||
'name': name,
|
||||
'prefix': classPrefix,
|
||||
if (pluginClass != null) 'class': pluginClass,
|
||||
if (dartPluginClass != null) kDartPluginClass: dartPluginClass,
|
||||
if (dartFileName != null) kDartFileName: dartFileName,
|
||||
'class': ?pluginClass,
|
||||
kDartPluginClass: ?dartPluginClass,
|
||||
kDartFileName: ?dartFileName,
|
||||
if (ffiPlugin) kFfiPlugin: true,
|
||||
if (sharedDarwinSource) kSharedDarwinSource: true,
|
||||
if (defaultPackage != null) kDefaultPackage: defaultPackage,
|
||||
kDefaultPackage: ?defaultPackage,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -413,12 +413,12 @@ class MacOSPlugin extends PluginPlatform implements NativeOrDartPlugin, DarwinPl
|
||||
Map<String, dynamic> toMap() {
|
||||
return <String, dynamic>{
|
||||
'name': name,
|
||||
if (pluginClass != null) 'class': pluginClass,
|
||||
if (dartPluginClass != null) kDartPluginClass: dartPluginClass,
|
||||
if (dartFileName != null) kDartFileName: dartFileName,
|
||||
'class': ?pluginClass,
|
||||
kDartPluginClass: ?dartPluginClass,
|
||||
kDartFileName: ?dartFileName,
|
||||
if (ffiPlugin) kFfiPlugin: true,
|
||||
if (sharedDarwinSource) kSharedDarwinSource: true,
|
||||
if (defaultPackage != null) kDefaultPackage: defaultPackage,
|
||||
kDefaultPackage: ?defaultPackage,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -513,12 +513,12 @@ class WindowsPlugin extends PluginPlatform implements NativeOrDartPlugin, Varian
|
||||
Map<String, dynamic> toMap() {
|
||||
return <String, dynamic>{
|
||||
'name': name,
|
||||
if (pluginClass != null) 'class': pluginClass,
|
||||
'class': ?pluginClass,
|
||||
if (pluginClass != null) 'filename': _filenameForCppClass(pluginClass!),
|
||||
if (dartPluginClass != null) kDartPluginClass: dartPluginClass,
|
||||
if (dartFileName != null) kDartFileName: dartFileName,
|
||||
kDartPluginClass: ?dartPluginClass,
|
||||
kDartFileName: ?dartFileName,
|
||||
if (ffiPlugin) kFfiPlugin: true,
|
||||
if (defaultPackage != null) kDefaultPackage: defaultPackage,
|
||||
kDefaultPackage: ?defaultPackage,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -596,12 +596,12 @@ class LinuxPlugin extends PluginPlatform implements NativeOrDartPlugin {
|
||||
Map<String, dynamic> toMap() {
|
||||
return <String, dynamic>{
|
||||
'name': name,
|
||||
if (pluginClass != null) 'class': pluginClass,
|
||||
'class': ?pluginClass,
|
||||
if (pluginClass != null) 'filename': _filenameForCppClass(pluginClass!),
|
||||
if (dartPluginClass != null) kDartPluginClass: dartPluginClass,
|
||||
if (dartFileName != null) kDartFileName: dartFileName,
|
||||
kDartPluginClass: ?dartPluginClass,
|
||||
kDartFileName: ?dartFileName,
|
||||
if (ffiPlugin) kFfiPlugin: true,
|
||||
if (defaultPackage != null) kDefaultPackage: defaultPackage,
|
||||
kDefaultPackage: ?defaultPackage,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -414,8 +414,8 @@ class FlutterProject {
|
||||
final String? buildNumber = manifest.buildNumber;
|
||||
final versionFileJson = <String, String>{
|
||||
'app_name': manifest.appName,
|
||||
if (buildName != null) 'version': buildName,
|
||||
if (buildNumber != null) 'build_number': buildNumber,
|
||||
'version': ?buildName,
|
||||
'build_number': ?buildNumber,
|
||||
'package_name': manifest.appName,
|
||||
};
|
||||
return jsonEncode(versionFileJson);
|
||||
|
||||
@ -519,7 +519,7 @@ class _ProxiedLogReader extends DeviceLogReader {
|
||||
(String? applicationPackageId) async => _cast<String>(
|
||||
await connection.sendRequest('device.logReader.start', <String, Object>{
|
||||
'deviceId': device.id,
|
||||
if (applicationPackageId != null) 'applicationPackageId': applicationPackageId,
|
||||
'applicationPackageId': ?applicationPackageId,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
@ -379,8 +379,8 @@ class LogToFileAnalytics extends AnalyticsMock {
|
||||
final parameters = <String, String>{
|
||||
'variableName': variableName,
|
||||
'time': '$time',
|
||||
if (category != null) 'category': category,
|
||||
if (label != null) 'label': label,
|
||||
'category': ?category,
|
||||
'label': ?label,
|
||||
};
|
||||
_sendController.add(parameters);
|
||||
logFile.writeAsStringSync('timing $parameters\n', mode: FileMode.append);
|
||||
|
||||
@ -138,7 +138,7 @@ class FlutterTesterTestDevice extends TestDevice {
|
||||
'APP_NAME': flutterProject?.manifest.appName ?? '',
|
||||
if (debuggingOptions.enableImpeller == ImpellerStatus.enabled)
|
||||
'FLUTTER_TEST_IMPELLER': 'true',
|
||||
if (testAssetDirectory != null) 'UNIT_TEST_ASSETS': testAssetDirectory!,
|
||||
'UNIT_TEST_ASSETS': ?testAssetDirectory,
|
||||
if (platform.isWindows && nativeAssetsBuilder != null && flutterProject != null)
|
||||
'PATH':
|
||||
'${nativeAssetsBuilder!.windowsBuildDirectory(flutterProject!)};${platform.environment['PATH']}',
|
||||
|
||||
@ -57,7 +57,7 @@ shelf.Handler createDirectoryHandler(Directory directory, {required bool crossOr
|
||||
return shelf.Response.ok(
|
||||
file.openRead(),
|
||||
headers: <String, String>{
|
||||
if (contentType != null) 'Content-Type': contentType,
|
||||
'Content-Type': ?contentType,
|
||||
if (needsCrossOriginIsolated) ...kMultiThreadedHeaders,
|
||||
},
|
||||
);
|
||||
|
||||
@ -734,7 +734,7 @@ class SpawnPlugin extends PlatformPlugin {
|
||||
'FLUTTER_TEST': flutterTest,
|
||||
'FONTCONFIG_FILE': FontConfigManager().fontConfigFile.path,
|
||||
'APP_NAME': flutterProject.manifest.appName,
|
||||
if (testAssetDirectory != null) 'UNIT_TEST_ASSETS': testAssetDirectory,
|
||||
'UNIT_TEST_ASSETS': ?testAssetDirectory,
|
||||
if (nativeAssetsBuilder != null && globals.platform.isWindows)
|
||||
'PATH':
|
||||
'${nativeAssetsBuilder.windowsBuildDirectory(flutterProject)};${globals.platform.environment['PATH']}',
|
||||
|
||||
@ -271,9 +271,9 @@ abstract class FlutterVersion {
|
||||
'frameworkRevision': frameworkRevision,
|
||||
'frameworkCommitDate': frameworkCommitDate,
|
||||
'engineRevision': engineRevision,
|
||||
if (engineCommitDate != null) 'engineCommitDate': engineCommitDate!,
|
||||
if (engineContentHash != null) 'engineContentHash': engineContentHash!,
|
||||
if (engineBuildDate != null) 'engineBuildDate': engineBuildDate!,
|
||||
'engineCommitDate': ?engineCommitDate,
|
||||
'engineContentHash': ?engineContentHash,
|
||||
'engineBuildDate': ?engineBuildDate,
|
||||
'dartSdkVersion': dartSdkVersion,
|
||||
'devToolsVersion': devToolsVersion,
|
||||
'flutterVersion': frameworkVersion,
|
||||
|
||||
@ -789,7 +789,7 @@ class FlutterVmService {
|
||||
}) async {
|
||||
final vm_service.Response? response = await _checkedCallServiceExtension(
|
||||
method,
|
||||
args: <String, Object?>{if (isolateId != null) 'isolateId': isolateId, ...?args},
|
||||
args: <String, Object?>{'isolateId': ?isolateId, ...?args},
|
||||
);
|
||||
return response?.json;
|
||||
}
|
||||
|
||||
@ -102,8 +102,8 @@ class WebBuilder {
|
||||
defines: <String, String>{
|
||||
kTargetFile: target,
|
||||
kHasWebPlugins: hasWebPlugins.toString(),
|
||||
if (baseHref != null) kBaseHref: baseHref,
|
||||
if (staticAssetsUrl != null) kStaticAssetsUrl: staticAssetsUrl,
|
||||
kBaseHref: ?baseHref,
|
||||
kStaticAssetsUrl: ?staticAssetsUrl,
|
||||
kServiceWorkerStrategy: serviceWorkerStrategy.cliName,
|
||||
...buildInfo.toBuildSystemEnvironment(),
|
||||
},
|
||||
|
||||
@ -43,7 +43,7 @@ sealed class WebCompilerConfig {
|
||||
String get buildKey;
|
||||
|
||||
Map<String, Object> get buildEventAnalyticsValues => <String, Object>{
|
||||
if (optimizationLevel != null) 'optimizationLevel': optimizationLevel!,
|
||||
'optimizationLevel': ?optimizationLevel,
|
||||
};
|
||||
|
||||
Map<String, dynamic> get _buildKeyMap => <String, dynamic>{
|
||||
|
||||
@ -281,7 +281,7 @@ void _writeGeneratedFlutterConfig(
|
||||
'FLUTTER_ROOT': Cache.flutterRoot!,
|
||||
'FLUTTER_EPHEMERAL_DIR': windowsProject.ephemeralDirectory.path,
|
||||
'PROJECT_DIR': windowsProject.parent.directory.path,
|
||||
if (target != null) 'FLUTTER_TARGET': target,
|
||||
'FLUTTER_TARGET': ?target,
|
||||
...buildInfo.toEnvironmentConfig(),
|
||||
};
|
||||
final LocalEngineInfo? localEngineInfo = globals.artifacts?.localEngineInfo;
|
||||
|
||||
@ -49,7 +49,7 @@ class FakeXcodeProjectInterpreterWithBuildSettings extends FakeXcodeProjectInter
|
||||
'PRODUCT_BUNDLE_IDENTIFIER': productBundleIdentifier ?? 'io.flutter.someProject',
|
||||
'TARGET_BUILD_DIR': 'build/ios/Release-iphoneos',
|
||||
'WRAPPER_NAME': 'Runner.app',
|
||||
if (developmentTeam != null) 'DEVELOPMENT_TEAM': developmentTeam!,
|
||||
'DEVELOPMENT_TEAM': ?developmentTeam,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -770,7 +770,7 @@ FakeVmServiceHost createFakeVmServiceHostWithFooAndBar({
|
||||
'forceCompile': true,
|
||||
'reportLines': true,
|
||||
'librariesAlreadyCompiled': librariesAlreadyCompiled,
|
||||
if (libraryFilters != null) 'libraryFilters': libraryFilters,
|
||||
'libraryFilters': ?libraryFilters,
|
||||
},
|
||||
jsonResponse: SourceReport(
|
||||
ranges: <SourceReportRange>[
|
||||
|
||||
@ -197,7 +197,7 @@ void main() {
|
||||
Map<String, Object?> testCommand(int id, [int? binarySize]) => <String, Object?>{
|
||||
'id': id,
|
||||
'method': 'test',
|
||||
if (binarySize != null) '_binaryLength': binarySize,
|
||||
'_binaryLength': ?binarySize,
|
||||
};
|
||||
List<int> testCommandBinary(int id, [int? binarySize]) =>
|
||||
utf8.encode('[${json.encode(testCommand(id, binarySize))}]\n');
|
||||
|
||||
@ -242,7 +242,7 @@ void main() {
|
||||
}
|
||||
|
||||
String _encodeStdout({required bool success, String? message}) {
|
||||
return jsonEncode(<String, Object?>{'success': success, if (message != null) 'message': message});
|
||||
return jsonEncode(<String, Object?>{'success': success, 'message': ?message});
|
||||
}
|
||||
|
||||
final class _FakeTestCompiler extends Fake implements TestCompiler {
|
||||
|
||||
@ -735,7 +735,7 @@ void main() {
|
||||
|
||||
VersionCheckError? runUpstreamValidator({String? versionUpstreamUrl, String? flutterGitUrl}) {
|
||||
final Platform testPlatform = FakePlatform(
|
||||
environment: <String, String>{if (flutterGitUrl != null) 'FLUTTER_GIT_URL': flutterGitUrl},
|
||||
environment: <String, String>{'FLUTTER_GIT_URL': ?flutterGitUrl},
|
||||
);
|
||||
return VersionUpstreamValidator(
|
||||
version: FakeFlutterVersion(repositoryUrl: versionUpstreamUrl),
|
||||
|
||||
@ -376,7 +376,7 @@ bool analyticsTimingEventExists({
|
||||
final lookup = <String, String>{
|
||||
'workflow': workflow,
|
||||
'variableName': variableName,
|
||||
if (label != null) 'label': label,
|
||||
'label': ?label,
|
||||
};
|
||||
|
||||
for (final e in sentEvents) {
|
||||
|
||||
@ -726,7 +726,7 @@ class FakeJava extends Fake implements Java {
|
||||
}) : binaryPath = binary,
|
||||
version = version ?? const Version.withText(19, 0, 2, 'openjdk 19.0.2 2023-01-17'),
|
||||
_environment = <String, String>{
|
||||
if (javaHome != null) Java.javaHomeEnvironmentVariable: javaHome,
|
||||
Java.javaHomeEnvironmentVariable: ?javaHome,
|
||||
'PATH': '/android-studio/jbr/bin',
|
||||
},
|
||||
_canRun = canRun;
|
||||
|
||||
@ -72,7 +72,7 @@ class Response {
|
||||
String toJson() => json.encode(<String, dynamic>{
|
||||
'result': allTestsPassed.toString(),
|
||||
'failureDetails': _failureDetailsAsString(),
|
||||
if (data != null) 'data': data,
|
||||
'data': ?data,
|
||||
});
|
||||
|
||||
/// Deserializes the result from JSON.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user