getBookmarks method
Gets the bookmarks of the current document. example:
List<CPDFBookmark> bookmarks = await document.getBookmarks();
Implementation
Future<List<CPDFBookmark>> getBookmarks() async {
final bookmarks = await _channel.invokeMethod('get_bookmarks');
if (bookmarks is! List) return [];
return bookmarks
.whereType<Map>()
.map((item) {
try {
final map = Map<String, dynamic>.from(item);
return CPDFBookmark.fromJson(map);
} catch (e, stack) {
debugPrint('CPDFBookmark parse error: $e\n$stack');
return null;
}
})
.whereType<CPDFBookmark>()
.toList();
}