PcoCollection<T extends PcoResource> class Null safety

PcoCollection represents any response that has one or more items of data from the server. Most requests will return a PcoCollection.

Information like endpoint and apiVersion will be preserved so future queries can be generated from existing collections. Also, meta preserves the meta section of the ApiResponse, query preserves the original query for the collection, and response preserves the full response from the API Request. Finally items is a typed list of the response data encapsulated by the appropriate class.

Once you have a PcoCollection, you can load more items (if there are more) by calling nextPage to get a new collection with the next page of data or by calling getMore to extend the current collection with the next page of data.


PcoCollection(List<T> items, PlanningCenterApiMeta meta, PlanningCenterApiResponse<PlanningCenterApiData> response, PlanningCenterApiQuery query, String endpoint, String apiVersion)
PcoCollection.fromApiResponse(PlanningCenterApiResponse<PlanningCenterApiData> response, dynamic endpoint, dynamic apiVersion)
we also require the original endpoint and the apiversion so that subsequent requests like getMore and nextPage can be built easily off of this one.


apiVersion String
data List<T>
@Deprecated: use items instead
endpoint String
error PlanningCenterApiError?
errorMessage String
firstOrNull → T?
hashCode int
The hash code for this object.
hasMore bool
isError bool
isSingle bool
items List<T>
read / write
meta PlanningCenterApiMeta
read / write
query PlanningCenterApiQuery
read / write
response PlanningCenterApiResponse<PlanningCenterApiData>
read / write
runtimeType Type
A representation of the runtime type of the object.


getMore() Future<bool>
If a collection has more items available on the server getMore will call nextPage internally, will extend the current data with the the new data and then will update this collection with new query, meta, and response values.
nextPage() Future<PcoCollection<T>>
nextPage will return a new collection representing the next page of data from the server. The page offset is stored in the metadata of the previous response. If the server has no more items, the API will be called with an offset equal to the total count of items as reported by the server on the previous request.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.

Static Methods

fromApiCall<T extends PcoResource>(String endpoint, {PlanningCenterApiQuery? query, required String apiVersion}) Future<PcoCollection<T>>
url, query: query, apiVersion:kApiVersion