SanityClient class

The client for fetching data from Sanity

Constructors

SanityClient(SanityConfig config, {Client? httpClient, UrlBuilder? urlBuilder})

Properties

config SanityConfig
The configuration for the client
final
hashCode int
The hash code for this object.
no setterinherited
httpClient → Client
The HTTP client to use. Generally not needed to be provided. It is used for testing purposes
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
urlBuilder UrlBuilder
The URL builder to use. When not provided it uses the default Sanity URL builder
final

Methods

datasets() Future<List<SanityDataset>>
Fetches the associated datasets with this project
fetch(String query, {Map<String, String>? params}) Future<SanityQueryResponse>
Fetches data from Sanity by running the GROQ Query with the passed in parameters
fileUrl(String fileRefId) Uri
Return the associated object url
imageUrl(String imageRefId, {int? width, int? height, int? devicePixelRatio, int? quality, String? format}) Uri
Return the associated image url
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryUrl(String query, {Map<String, String>? params}) Uri
The URL for the query
toString() String
A string representation of this object.
inherited

Operators

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