Strapi class

A singleton you can access it from anywhere like

Strapi.instance;
//or
Strapi.i;

Strapi instance is what you need to do authentication with strapi server and get a jwt token, it is also easier to make authenticated request using request method

Properties

hashCode int
The hash code for this object.
no setterinherited
host String
getter/setter pair
maxListenersForAnObject int
max listeners for an object id, exception will be thrown if the max number of listners crosses Strapi.i.maxListenersForAnObject, set it as per requirement
getter/setter pair
maxTimeOutInMillis int
maximum timeout for any http request you make
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldUseHttps bool
should the requests use 'https' or not defaults to false
getter/setter pair
strapiToken String
getter/setter pair
userPresent bool
gets whether a user is authenticated or not, if no user present call any authentication methods first, or if you need to add a new method for your custom provider at strapi, consider adding a extension method on Strapi like
no setter
verbose bool
output the error to console if any
getter/setter pair

Methods

authenticateWithFirebase2Uid({required String firebaseUid}) Future<StrapiResponse>
authenticateWithFirebaseUid({required String firebaseUid}) Future<StrapiResponse>
to use this method first you need to add a custom provider for strapi with Firebase SDK enabled otherwise you'll recieve "This provider is disabled." response, go here https://yadunandan.xyz/authenticateWithFirebaseForStrapi to know how to add firebase as a authentication method, as of now it is the only method which is supported in authenticating with strapi
graphRequest(String queryString, {int maxTimeOutInMillis = 15000}) Future<StrapiResponse>
do a graph request to the strapi server, pass the queryString mostly generated using, StrapiCollectionQuery or StrapiModelQuery, maxTimeOutInMillis for the request can be set, returns a StrapiResponse which will contain graph response map in its body throws StrapiResponseException if request is failed
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request(String path, {Map<String, dynamic>? body, String? method, Map<String, String>? params, String? queryString, int? maxTimeOutInMillis}) Future<StrapiResponse>
an authentcated strapi request making towards the endpionts of your strapi server, in every request you make a authorization token is inserted automatically if the strapiToken is present otherwise the request will be plain unauthenticated request, host will be used a your strapi server path will be your endpoint, for example if you need to count restaurants collection
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

i Strapi
get Strapi instance
no setter
instance Strapi
get Strapi instance
no setter