getNoteList function
- BuildContext context,
- Widget childPage
Get the map comprising the list of notes and their data to return notesMap.
Parameters:
childPage
is the child widget to return to
Implementation
Future<Map<String, dynamic>> getNoteList(
BuildContext context,
Widget childPage,
) async {
final List<String> fileList;
// Get list of files in user's Pod
fileList = await getResources(context, childPage);
try {
String webId = await getWebId() as String;
webId = webId.replaceAll(profCard, '');
Map<String, dynamic> notesMap = {};
// Loop through file list to retrieve note data
// for each file
for (final fileName in fileList) {
// Read file content
if (context.mounted) {
String noteContent =
await readPod(fileName.replaceAll(webId, ''), context, childPage);
//debugPrint('NoteInfoMap: $fileName');
notesMap[fileName] = noteInfoMap(noteContent);
//debugPrint('$fileName => ${notesMap[fileName]}');
}
}
return notesMap;
} on Object catch (e) {
debugPrint(e.toString());
rethrow;
}
}