parseDocsDesc function
- dynamic docsDescJson
Parses a docsDesc array into appendix descriptors; null yields an empty list, a non-list throws.
Implementation
List<Map<String, String>> parseDocsDesc(dynamic docsDescJson) {
final docsDesc = <Map<String, String>>[];
if (docsDescJson == null) return docsDesc;
if (docsDescJson is! List) {
throw FormatException('docsDesc must be a List');
}
for (final element in docsDescJson) {
if (element is! Map) continue;
docsDesc.add({
'baseDir': element['baseDir']?.toString() ?? '',
'title': element['title']?.toString() ?? '',
'additionalInfo': element['additionalInfo']?.toString() ?? '',
});
}
return docsDesc;
}