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