queryTextActions method

  1. @override
Future<List<ProcessTextAction>> queryTextActions()
override

Returns a Future that resolves to a List of ProcessTextActions containing all text processing actions available.

If there are no actions available, an empty list will be returned.

Implementation

@override
Future<List<ProcessTextAction>> queryTextActions() async {
  final Map<Object?, Object?> rawResults;

  try {
    final Map<Object?, Object?>? result =
        await _processTextChannel.invokeMethod(
      'ProcessText.queryTextActions',
    ) as Map<Object?, Object?>?;

    if (result == null) {
      return <ProcessTextAction>[];
    }

    rawResults = result;
  } catch (e) {
    return <ProcessTextAction>[];
  }

  return <ProcessTextAction>[
    for (final Object? id in rawResults.keys)
      ProcessTextAction(id! as String, rawResults[id]! as String),
  ];
}