getAnnotations method

Future<List<Annotation>> getAnnotations(
  1. int pageIndex, [
  2. AnnotationType type = AnnotationType.all
])

Returns the typed annotations on pageIndex, optionally filtered by type (defaults to all types).

Filtering is done on the parsed annotation type rather than via the native filter argument, which is inconsistent across platforms — this keeps behavior identical on Android, iOS, and Web.

Implementation

Future<List<Annotation>> getAnnotations(
  int pageIndex, [
  AnnotationType type = AnnotationType.all,
]) async {
  final annotations =
      _parseAnnotationList(await getAnnotationsJson(pageIndex, 'all'));
  if (type == AnnotationType.all) return annotations;
  return annotations.where((a) => a.type == type).toList();
}