getCodeListByKeyword method

Future<Map<String?, String>> getCodeListByKeyword(
  1. String keyword
)

Implementation

Future<Map<String?, String>> getCodeListByKeyword(String keyword) async {
  CodeDisplayService codeDisplayService = CodeDisplayService();
  Map<String?, String> result = <String?, String>{};
  final scriptIds = await codeDisplayService.getScriptIdsWithKeyword(keyword);
  if (scriptIds.isNotEmpty) {
    for (final entry in scriptIds.entries) {
      final code =
          await codeDisplayService.getSourceCodeWithScriptId(entry.key!);
      if (code != null && code.isNotEmpty) {
        result[entry.value] = code;
      }
    }
  }
  return result;
}