getCollection method

Future<Page<Document>> getCollection(
  1. String path,
  2. int pageSize,
  3. String nextPageToken
)

Implementation

Future<Page<Document>> getCollection(
    String path, int pageSize, String nextPageToken) async {
  var request = ListDocumentsRequest()
    ..parent = path.substring(0, path.lastIndexOf('/'))
    ..collectionId = path.substring(path.lastIndexOf('/') + 1)
    ..pageSize = pageSize
    ..pageToken = nextPageToken;
  var response =
      await _client.listDocuments(request).catchError(_handleError);
  var documents =
      response.documents.map((rawDocument) => Document(this, rawDocument));
  return Page(documents, response.nextPageToken);
}