loadRuntimeHints method

Future<List<RuntimeHintEntry>> loadRuntimeHints({
  1. bool forTests = false,
})
inherited

Loads cached runtime hint entries from the JSON file.

Implementation

Future<List<RuntimeHintEntry>> loadRuntimeHints({
  bool forTests = false,
}) async {
  final file = JetleafPaths.hintRegistryJson(projectRoot, forTests: forTests);
  if (!file.existsSync()) return [];

  try {
    final content = await file.readAsString();
    final List<dynamic> data = jsonDecode(content);
    return data
        .map((e) => RuntimeHintEntry.fromJson(e as Map<String, dynamic>))
        .toList();
  } catch (_) {
    return [];
  }
}