Flutter Guide • Community Forum • Stack Overflow • Report a Bug • Support
algoliasearch
is a comprehensive Dart package that provides access to Algolia's robust search and insights features. It is an all-in-one solution designed to help you integrate Algolia within your Dart project seamlessly and efficiently.
The package currently offers the following clients:
Future updates will include more clients to cover the entirety of Algolia's feature set, providing a complete toolset for building powerful, interactive search experiences in your Dart or Flutter application.
To use this package in your project, add it as a dependency:
dart pub add algoliasearch
flutter pub add algoliasearch
You can now import the Algolia API client in your project and play with it.
import 'package:algolia_client_search/algolia_client_search.dart';
// Alternatively, you can import `algoliasearch_lite`, a **search-only** version of the library, if you do not need the full feature set:
// import 'package:algoliasearch/algoliasearch_lite.dart';
final client = SearchClient(appId: 'YOUR_APP_ID', apiKey: 'YOUR_API_KEY');
// Add a new record to your Algolia index
final response = await client.saveObject(
indexName: "<YOUR_INDEX_NAME>",
body: {
'objectID': "id",
'test': "val",
},
);
// Poll the task status to know when it has been indexed
await client.waitTask('<YOUR_INDEX_NAME>', response.taskID);
// Fetch search results, with typo tolerance
final response = await client.search(
searchMethodParams: SearchMethodParams(
requests: [
SearchForHits(
indexName: "<YOUR_INDEX_NAME>",
query: "<YOUR_QUERY>",
hitsPerPage: 50,
),
],
),
);
Encountering an issue? Before reaching out to support, we recommend heading to our FAQ where you will find answers for the most common issues and gotchas with the client. You can also open a GitHub issue
This repository hosts the code of the generated Algolia API client for Dart, if you'd like to contribute, head over to the main repository. You can also find contributing guides on our documentation website.
The Algolia Dart API Client is an open-sourced software licensed under the MIT license.