StrapiCollection class

basic queries against a collection object of strapi

Constructors

StrapiCollection()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

count(String collection) Future<int>
count the objects in the collection, throws StrapiResponseException if response is failed
create({required String collection, required Map<String, dynamic> data}) Future<Map<String, dynamic>>
create a new object at collection with the provided data, returns the object with a id, throws StrapiResponseException if response is failed
customEndpoint({required String collection, required String endPoint, Map<String, String>? params, String? method, int? limit}) Future<List<Map<String, dynamic>>>
use this to reach a custom endpoint you've setup for a strapi collection if you setup a endpoint name xEndPoint for collection name xCollection and the resulting route is /xCollection/xEndPoint, then you have to use this method like this
delete({required String collection, required String id}) Future<Map<String, dynamic>>
deletes a object with id at collection
findMultiple({required String collection, int? limit}) Future<List<Map<String, dynamic>>>
returns all objects in a collection, run get query against a collection, limit the number of objects in the response by setting limit, throws StrapiResponseException if response is failed
findOne({required String collection, required String id}) Future<Map<String, dynamic>>
gets a single object in a collection with id, throws StrapiResponseException if response is failed
update({required String collection, required String id, required Map<String, dynamic> data}) Future<Map<String, dynamic>>
update a object with id at collection with the new data, returns updated object, throws StrapiResponseException if response is failed