sanity_client 1.4.2 copy "sanity_client: ^1.4.2" to clipboard
sanity_client: ^1.4.2 copied to clipboard

Native Dart client to run GROQ queries and fetch documents from Sanity.io

example/lib/example.dart

import 'package:sanity_client/sanity_client.dart';

Future<void> main() async {
  // using the SanityClient
  var client = SanityClient(
    SanityConfig(
      projectId: 'your_project_id',
      dataset: 'your_dataset',
      token: 'your_token',
      perspective: Perspective.published,
      explainQuery: true,
      useCdn: true,
      apiVersion: 'v2024-02-16',
    ),
  );

  // make a query
  var query = '''
    *[_type == "movie"]{
      _id,
      title,
      releaseDate,
      "director": crewMembers[job == "Director"][0].person->name
    }
  ''';

  final response = await client.fetch(query);
  // ignore: avoid_print
  print(response);
}
3
likes
0
points
583
downloads

Publisher

verified publishervyuh.tech

Weekly Downloads

Native Dart client to run GROQ queries and fetch documents from Sanity.io

Homepage
Repository (GitHub)
View/report issues

Topics

#sanity #client #query #json #vyuh

License

unknown (license)

Dependencies

flutter, http, json_annotation

More

Packages that depend on sanity_client