Unverified Commit 0cef3f16 authored by Kevin Moore's avatar Kevin Moore Committed by GitHub

Correctly handle null case in ProcessText.queryTextActions (#141205)

Replace `as Map<Object?, Object?>` to handle nullable case
Fixes runtime issue in Wasm

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
parent 988d1a06
......@@ -113,22 +113,27 @@ class DefaultProcessTextService implements ProcessTextService {
@override
Future<List<ProcessTextAction>> queryTextActions() async {
final List<ProcessTextAction> textActions = <ProcessTextAction>[];
final Map<Object?, Object?>? rawResults;
final Map<Object?, Object?> rawResults;
try {
rawResults = await _processTextChannel.invokeMethod(
final Map<Object?, Object?>? result =
await _processTextChannel.invokeMethod(
'ProcessText.queryTextActions',
) as Map<Object?, Object?>;
} catch (e) {
return textActions;
) as Map<Object?, Object?>?;
if (result == null) {
return <ProcessTextAction>[];
}
for (final Object? id in rawResults.keys) {
textActions.add(ProcessTextAction(id! as String, rawResults[id]! as String));
rawResults = result;
} catch (e) {
return <ProcessTextAction>[];
}
return textActions;
return <ProcessTextAction>[
for (final Object? id in rawResults.keys)
ProcessTextAction(id! as String, rawResults[id]! as String),
];
}
@override
......
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