executeAction method
- {required BuildContext context,
- required WidgetRef ref,
- required AppModel appModel,
- required CreatorModel creatorModel,
- required DictionaryHeading heading,
- required String? dictionaryName}
override
Execute the functionality of this action.
Implementation
@override
Future<void> executeAction({
required BuildContext context,
required WidgetRef ref,
required AppModel appModel,
required CreatorModel creatorModel,
required DictionaryHeading heading,
required String? dictionaryName,
}) async {
StringBuffer buffer = StringBuffer();
buffer.write(heading.term);
if (heading.reading.isNotEmpty) {
buffer.write(' (${heading.reading})');
}
buffer.write('\n\n');
buffer.write(
MeaningField.flattenMeanings(
entries: heading.entries.toList(),
prependDictionaryNames:
appModel.lastSelectedMapping.prependDictionaryNames ?? false),
);
String shareText = buffer.toString();
Share.share(shareText);
}