prepareNameYomichanFormat function

Future<String> prepareNameYomichanFormat(
  1. PrepareDirectoryParams params
)

Top-level function for use in compute. See DictionaryFormat for details.

Implementation

Future<String> prepareNameYomichanFormat(PrepareDirectoryParams params) async {
  /// Get the index, which contains the name of the dictionary contained by
  /// the archive.
  String indexFilePath = path.join(params.workingDirectory.path, 'index.json');
  File indexFile = File(indexFilePath);
  String indexJson = indexFile.readAsStringSync();
  Map<String, dynamic> index = jsonDecode(indexJson);

  String dictionaryName = (index['title'] as String).trim();
  return dictionaryName;
}