after method

  1. @override
Future<Page<T, C>> after(
  1. K? key,
  2. C? cursor,
  3. int count
)
override

Fetches the Page after the provided key or cursor.

Implementation

@override
Future<Page<T, C>> after(K? key, C? cursor, int count) async {
  final Page<T, C> cached = await driftProvider.after(key, cursor, count);

  if (!alwaysFetch && cached.edges.isNotEmpty) {
    return cached;
  }

  final Page<T, C> remote = await graphQlProvider.after(key, cursor, count);

  // Await is omitted as it doesn't really form the page returned, it just
  // stores the data fetched to the drift, which might be happening in
  // parallel.
  driftProvider.put(remote.edges);

  return remote;
}