Unverified Commit b9ead372 authored by Ahmed Ashour's avatar Ahmed Ashour Committed by GitHub

Simplify null check. (#117026)

* Simplify null check.

* Simplify null check.

* Simplify null check.

* Fix.
parent ccfd14b0
...@@ -1004,45 +1004,45 @@ class DebuggingOptions { ...@@ -1004,45 +1004,45 @@ class DebuggingOptions {
static DebuggingOptions fromJson(Map<String, Object?> json, BuildInfo buildInfo) => static DebuggingOptions fromJson(Map<String, Object?> json, BuildInfo buildInfo) =>
DebuggingOptions._( DebuggingOptions._(
buildInfo: buildInfo, buildInfo: buildInfo,
debuggingEnabled: (json['debuggingEnabled'] as bool?)!, debuggingEnabled: json['debuggingEnabled']! as bool,
startPaused: (json['startPaused'] as bool?)!, startPaused: json['startPaused']! as bool,
dartFlags: (json['dartFlags'] as String?)!, dartFlags: json['dartFlags']! as String,
dartEntrypointArgs: ((json['dartEntrypointArgs'] as List<dynamic>?)?.cast<String>())!, dartEntrypointArgs: (json['dartEntrypointArgs']! as List<dynamic>).cast<String>(),
disableServiceAuthCodes: (json['disableServiceAuthCodes'] as bool?)!, disableServiceAuthCodes: json['disableServiceAuthCodes']! as bool,
enableDds: (json['enableDds'] as bool?)!, enableDds: json['enableDds']! as bool,
cacheStartupProfile: (json['cacheStartupProfile'] as bool?)!, cacheStartupProfile: json['cacheStartupProfile']! as bool,
enableSoftwareRendering: (json['enableSoftwareRendering'] as bool?)!, enableSoftwareRendering: json['enableSoftwareRendering']! as bool,
skiaDeterministicRendering: (json['skiaDeterministicRendering'] as bool?)!, skiaDeterministicRendering: json['skiaDeterministicRendering']! as bool,
traceSkia: (json['traceSkia'] as bool?)!, traceSkia: json['traceSkia']! as bool,
traceAllowlist: json['traceAllowlist'] as String?, traceAllowlist: json['traceAllowlist'] as String?,
traceSkiaAllowlist: json['traceSkiaAllowlist'] as String?, traceSkiaAllowlist: json['traceSkiaAllowlist'] as String?,
traceSystrace: (json['traceSystrace'] as bool?)!, traceSystrace: json['traceSystrace']! as bool,
endlessTraceBuffer: (json['endlessTraceBuffer'] as bool?)!, endlessTraceBuffer: json['endlessTraceBuffer']! as bool,
dumpSkpOnShaderCompilation: (json['dumpSkpOnShaderCompilation'] as bool?)!, dumpSkpOnShaderCompilation: json['dumpSkpOnShaderCompilation']! as bool,
cacheSkSL: (json['cacheSkSL'] as bool?)!, cacheSkSL: json['cacheSkSL']! as bool,
purgePersistentCache: (json['purgePersistentCache'] as bool?)!, purgePersistentCache: json['purgePersistentCache']! as bool,
useTestFonts: (json['useTestFonts'] as bool?)!, useTestFonts: json['useTestFonts']! as bool,
verboseSystemLogs: (json['verboseSystemLogs'] as bool?)!, verboseSystemLogs: json['verboseSystemLogs']! as bool,
hostVmServicePort: json['hostVmServicePort'] as int? , hostVmServicePort: json['hostVmServicePort'] as int? ,
deviceVmServicePort: json['deviceVmServicePort'] as int?, deviceVmServicePort: json['deviceVmServicePort'] as int?,
disablePortPublication: (json['disablePortPublication'] as bool?)!, disablePortPublication: json['disablePortPublication']! as bool,
ddsPort: json['ddsPort'] as int?, ddsPort: json['ddsPort'] as int?,
devToolsServerAddress: json['devToolsServerAddress'] != null ? Uri.parse(json['devToolsServerAddress']! as String) : null, devToolsServerAddress: json['devToolsServerAddress'] != null ? Uri.parse(json['devToolsServerAddress']! as String) : null,
port: json['port'] as String?, port: json['port'] as String?,
hostname: json['hostname'] as String?, hostname: json['hostname'] as String?,
webEnableExposeUrl: json['webEnableExposeUrl'] as bool?, webEnableExposeUrl: json['webEnableExposeUrl'] as bool?,
webUseSseForDebugProxy: (json['webUseSseForDebugProxy'] as bool?)!, webUseSseForDebugProxy: json['webUseSseForDebugProxy']! as bool,
webUseSseForDebugBackend: (json['webUseSseForDebugBackend'] as bool?)!, webUseSseForDebugBackend: json['webUseSseForDebugBackend']! as bool,
webUseSseForInjectedClient: (json['webUseSseForInjectedClient'] as bool?)!, webUseSseForInjectedClient: json['webUseSseForInjectedClient']! as bool,
webRunHeadless: (json['webRunHeadless'] as bool?)!, webRunHeadless: json['webRunHeadless']! as bool,
webBrowserDebugPort: json['webBrowserDebugPort'] as int?, webBrowserDebugPort: json['webBrowserDebugPort'] as int?,
webBrowserFlags: ((json['webBrowserFlags'] as List<dynamic>?)?.cast<String>())!, webBrowserFlags: (json['webBrowserFlags']! as List<dynamic>).cast<String>(),
webEnableExpressionEvaluation: (json['webEnableExpressionEvaluation'] as bool?)!, webEnableExpressionEvaluation: json['webEnableExpressionEvaluation']! as bool,
webLaunchUrl: json['webLaunchUrl'] as String?, webLaunchUrl: json['webLaunchUrl'] as String?,
vmserviceOutFile: json['vmserviceOutFile'] as String?, vmserviceOutFile: json['vmserviceOutFile'] as String?,
fastStart: (json['fastStart'] as bool?)!, fastStart: json['fastStart']! as bool,
nullAssertions: (json['nullAssertions'] as bool?)!, nullAssertions: json['nullAssertions']! as bool,
nativeNullAssertions: (json['nativeNullAssertions'] as bool?)!, nativeNullAssertions: json['nativeNullAssertions']! as bool,
enableImpeller: (json['enableImpeller'] as bool?) ?? false, enableImpeller: (json['enableImpeller'] as bool?) ?? false,
uninstallFirst: (json['uninstallFirst'] as bool?) ?? false, uninstallFirst: (json['uninstallFirst'] as bool?) ?? false,
enableDartProfiling: (json['enableDartProfiling'] as bool?) ?? true, enableDartProfiling: (json['enableDartProfiling'] as bool?) ?? true,
......
...@@ -292,7 +292,7 @@ void main() { ...@@ -292,7 +292,7 @@ void main() {
globals.fs.directory('bundle.app').createSync(); globals.fs.directory('bundle.app').createSync();
globals.fs.file('bundle.app/Info.plist').createSync(); globals.fs.file('bundle.app/Info.plist').createSync();
testPlistParser.setProperty('CFBundleIdentifier', 'fooBundleId'); testPlistParser.setProperty('CFBundleIdentifier', 'fooBundleId');
final PrebuiltIOSApp iosApp = (IOSApp.fromPrebuiltApp(globals.fs.file('bundle.app')) as PrebuiltIOSApp?)!; final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('bundle.app'))! as PrebuiltIOSApp;
expect(testLogger.errorText, isEmpty); expect(testLogger.errorText, isEmpty);
expect(iosApp.uncompressedBundle.path, 'bundle.app'); expect(iosApp.uncompressedBundle.path, 'bundle.app');
expect(iosApp.id, 'fooBundleId'); expect(iosApp.id, 'fooBundleId');
...@@ -343,7 +343,7 @@ void main() { ...@@ -343,7 +343,7 @@ void main() {
.file(globals.fs.path.join(bundleAppDir.path, 'Info.plist')) .file(globals.fs.path.join(bundleAppDir.path, 'Info.plist'))
.createSync(); .createSync();
}; };
final PrebuiltIOSApp iosApp = (IOSApp.fromPrebuiltApp(globals.fs.file('app.ipa')) as PrebuiltIOSApp?)!; final PrebuiltIOSApp iosApp = IOSApp.fromPrebuiltApp(globals.fs.file('app.ipa'))! as PrebuiltIOSApp;
expect(testLogger.errorText, isEmpty); expect(testLogger.errorText, isEmpty);
expect(iosApp.uncompressedBundle.path, endsWith('bundle.app')); expect(iosApp.uncompressedBundle.path, endsWith('bundle.app'));
expect(iosApp.id, 'fooBundleId'); expect(iosApp.id, 'fooBundleId');
...@@ -594,7 +594,7 @@ void main() { ...@@ -594,7 +594,7 @@ void main() {
testUsingContext('Success with far file', () { testUsingContext('Success with far file', () {
globals.fs.file('bundle.far').createSync(); globals.fs.file('bundle.far').createSync();
final PrebuiltFuchsiaApp fuchsiaApp = (FuchsiaApp.fromPrebuiltApp(globals.fs.file('bundle.far')) as PrebuiltFuchsiaApp?)!; final PrebuiltFuchsiaApp fuchsiaApp = FuchsiaApp.fromPrebuiltApp(globals.fs.file('bundle.far'))! as PrebuiltFuchsiaApp;
expect(testLogger.errorText, isEmpty); expect(testLogger.errorText, isEmpty);
expect(fuchsiaApp.id, 'bundle.far'); expect(fuchsiaApp.id, 'bundle.far');
expect(fuchsiaApp.applicationPackage.path, globals.fs.file('bundle.far').path); expect(fuchsiaApp.applicationPackage.path, globals.fs.file('bundle.far').path);
......
...@@ -117,8 +117,8 @@ class MockFlutterDebugAdapter extends FlutterDebugAdapter { ...@@ -117,8 +117,8 @@ class MockFlutterDebugAdapter extends FlutterDebugAdapter {
// Pretend to be the client, delegating any reverse-requests to the relevant // Pretend to be the client, delegating any reverse-requests to the relevant
// handler that is provided by the test. // handler that is provided by the test.
if (message is Event && message.event == 'flutter.forwardedRequest') { if (message is Event && message.event == 'flutter.forwardedRequest') {
final Map<String, Object?> body = (message.body as Map<String, Object?>?)!; final Map<String, Object?> body = message.body! as Map<String, Object?>;
final String method = (body['method'] as String?)!; final String method = body['method']! as String;
final Map<String, Object?>? params = body['params'] as Map<String, Object?>?; final Map<String, Object?>? params = body['params'] as Map<String, Object?>?;
final Object? result = _handleReverseRequest(method, params); final Object? result = _handleReverseRequest(method, params);
...@@ -138,7 +138,7 @@ class MockFlutterDebugAdapter extends FlutterDebugAdapter { ...@@ -138,7 +138,7 @@ class MockFlutterDebugAdapter extends FlutterDebugAdapter {
Object? _handleReverseRequest(String method, Map<String, Object?>? params) { Object? _handleReverseRequest(String method, Map<String, Object?>? params) {
switch (method) { switch (method) {
case 'app.exposeUrl': case 'app.exposeUrl':
final String url = (params!['url'] as String?)!; final String url = params!['url']! as String;
return exposeUrlHandler!(url); return exposeUrlHandler!(url);
default: default:
throw ArgumentError('Reverse-request $method is unknown'); throw ArgumentError('Reverse-request $method is unknown');
......
...@@ -193,6 +193,6 @@ bool _isHotReloadCompletionEvent(Map<String, Object?>? event) { ...@@ -193,6 +193,6 @@ bool _isHotReloadCompletionEvent(Map<String, Object?>? event) {
return event != null && return event != null &&
event['event'] == 'app.progress' && event['event'] == 'app.progress' &&
event['params'] != null && event['params'] != null &&
(event['params'] as Map<String, Object?>?)!['progressId'] == 'hot.reload' && (event['params']! as Map<String, Object?>)['progressId'] == 'hot.reload' &&
(event['params'] as Map<String, Object?>?)!['finished'] == true; (event['params']! as Map<String, Object?>)['finished'] == true;
} }
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
fileSystem.file('templates/template_manifest.json').readAsStringSync(), fileSystem.file('templates/template_manifest.json').readAsStringSync(),
) as Map<String, Object?>; ) as Map<String, Object?>;
final Set<Uri> declaredFileList = Set<Uri>.from( final Set<Uri> declaredFileList = Set<Uri>.from(
(manifest['files'] as List<Object?>?)!.cast<String>().map<Uri>(fileSystem.path.toUri)); (manifest['files']! as List<Object?>).cast<String>().map<Uri>(fileSystem.path.toUri));
final Set<Uri> activeTemplateList = fileSystem.directory('templates') final Set<Uri> activeTemplateList = fileSystem.directory('templates')
.listSync(recursive: true) .listSync(recursive: true)
......
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