loadAnnotatedMethods method
Loads cached annotated method entries from the JSON file.
Implementation
Future<List<AnnotatedMethodEntry>> loadAnnotatedMethods({
bool forTests = false,
}) async {
final file = JetleafPaths.annotatedMethodsJson(
projectRoot,
forTests: forTests,
);
if (!file.existsSync()) return [];
try {
final content = await file.readAsString();
final Map<String, dynamic> data = jsonDecode(content);
final entries = <AnnotatedMethodEntry>[];
for (final annotationEntry in data.entries) {
final annotationName = annotationEntry.key;
final methods = annotationEntry.value as List<dynamic>;
for (final method in methods) {
final methodMap = method as Map<String, dynamic>;
entries.add(
AnnotatedMethodEntry(
annotationName: annotationName,
className: methodMap['class'] as String? ?? '',
methodName: methodMap['method'] as String? ?? '',
uri: methodMap['uri'] as String? ?? '',
),
);
}
}
return entries;
} catch (_) {
return [];
}
}