{"id":10267,"date":"2023-06-23T01:43:43","date_gmt":"2023-06-23T08:43:43","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/dart-flutter-query-builder\/"},"modified":"2023-06-23T01:43:43","modified_gmt":"2023-06-23T08:43:43","slug":"dart-flutter-query-builder","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/","title":{"rendered":"Couchbase Lite Query Builder Engine with Dart and Flutter"},"content":{"rendered":"\n<h3 id=\"h-introduction\" class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Couchbase Lite brings powerful querying and Full-Text-Search(FTS) capabilties to the edge. The query builder interface is based on <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/www.couchbase.com\/sqlplusplus\">SQL++<\/a>, Couchbase\u2019s declarative query language that extends <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/www.sqlite.org\/index.html\">SQL<\/a> for JSON. If you are familiar with SQL, you will feel right at home with the semantics of the new API.  The query builder API is designed using the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fluent_interface\">Fluent API Design Pattern<\/a>, and it uses method cascading to read to like a Domain Specific Language (DSL). This makes the interface very intuitive and easy to understand.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this step of the learning path you will learn the fundamentals of:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using the QueryBuilder API<\/li>\n\n\n<li>Using Live Queries with streams<\/li>\n\n\n<li>Using JSON Serialization to &#8220;deserialize&#8221; documents from the database in to dart classes<\/li>\n\n\n<li>Using indexes to speed up a query<\/li>\n\n\n<li>Using the count function with the QueryBuilder API<\/li>\n\n\n<li>Using the LIKE operator to search for documents with a specific value in a field<\/li>\n\n<\/ul>\n\n\n\n<h3 id=\"h-app-overview\" class=\"wp-block-heading\">App Overview<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">While the demo app has a lot of functionality, this step will walk you through:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log in into the application<\/li>\n\n\n<li>Scrolling the list of projects<\/li>\n\n\n<li>Review the code for displaying projects<\/li>\n\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>NOTE<\/strong>:  This step assumes you completed the previous step <code>Batch operations<\/code> that loaded the sample data into the application.   This part of the learning path will not work if you don&#8217;t complete the previous steps.<\/p>\n<\/blockquote>\n\n\n\n<h3 id=\"h-installation\" class=\"wp-block-heading\">Installation<\/h3>\n\n\n\n<h4 id=\"h-fetching-app-source-code\" class=\"wp-block-heading\">Fetching App Source Code<\/h4>\n\n\n\n<h5 id=\"h-clone-source-code\" class=\"wp-block-heading\">Clone Source Code<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you haven&#8217;t already cloned the repo from the previous step, clone the <code>Learn Couchbase Lite with Dart and Flutter<\/code> repository from GitHub.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-bash\"><code>git clone https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path.git\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-try-it-out\" class=\"wp-block-heading\">Try it out<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open src folder using your favorite IDE<\/li>\n\n\n<li>Build and run the project.<\/li>\n\n\n<li>Log in to the app with  <strong><em>&#8220;<a href=\"mailto:demo@example.com\">demo@example.com<\/a>&#8220;<\/em><\/strong> and <strong><em>&#8220;P@ssw0rd12&#8221;<\/em><\/strong> for user Id and password fields respectively.<\/li>\n\n\n<li>Verify that you see sample projects on the screen.  If you do not see sample projects, please complete the previous step <strong>Batch operations<\/strong> to load sample data before continuing.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"project_listing.gif\" alt=\"Project Listing,400\"><\/p>\n\n\n\n<h3 id=\"h-data-model\" class=\"wp-block-heading\">Data Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A reminder that Couchbase Lite is a JSON Document Store. A <code>Document<\/code> is a logical collection of named fields and values. The values are any valid JSON types. In addition to the standard JSON types, Couchbase Lite supports <code>Date<\/code> and <code>Blob<\/code> data types. While it is not required or enforced, it is a recommended practice to include a <em>&#8220;documentType&#8221;<\/em> property that can serve as a namespace for related documents.<\/p>\n\n\n\n<h4 id=\"h-the-project-document\" class=\"wp-block-heading\">The Project Document<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The sample app was loaded with a collection of <code>Document<\/code> with a <em>&#8220;documentType&#8221;<\/em> property of <em>&#8220;project&#8221;<\/em> in the previous step.  Each document represents a project that a team would would work on and have to complete before the due date based on a selected location, which is another document type.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An example of a document would be:<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>{\n\t&quot;team&quot;: &quot;team1&quot;,\n\t&quot;modifiedOn&quot;: &quot;2022-10-12&quot;,\n\t&quot;documentType&quot;: &quot;project&quot;,\n\t&quot;createdBy&quot;: &quot;demo@example.com&quot;,\n\t&quot;dueDate&quot;: &quot;2022-10-31&quot;,\n\t&quot;name&quot;: &quot;Santa Clara Warehouse Audit&quot;,\n\t&quot;description&quot;: &quot;Audit of warehouse stock located in Santa Clara, CA.&quot;,\n\t&quot;modifiedBy&quot;: &quot;demo@example.com&quot;,\n\t&quot;warehouse&quot;: {\n\t\t&quot;documentType&quot;: &quot;warehouse&quot;,\n\t\t&quot;name&quot;: &quot;Santa Clara Warehouse&quot;,\n   \t&quot;shippingTo&quot;: [\n\t\t\t&quot;AZ&quot;,\n\t\t\t&quot;CA&quot;,\n\t\t\t&quot;HI&quot;,\n\t\t\t&quot;NV&quot;\n\t\t],\n\t\t&quot;warehouseId&quot;: &quot;e1839e0b-57a0-472c-b29d-8d57e256ef32&quot;,\n\t\t&quot;city&quot;: &quot;Santa Clara&quot;,\n\t\t&quot;address1&quot;: &quot;3250 Dr Olcott Street&quot;,\n\t\t&quot;postalCode&quot;: &quot;95054&quot;,\n\t\t&quot;latitude&quot;: 32.3803024,\n\t\t&quot;state&quot;: &quot;CA&quot;,\n\t\t&quot;salesTax&quot;: 0.0913,\n\t\t&quot;longitude&quot;: -121.9674197,\n\t\t&quot;yearToDateBalance&quot;: 0.0\n\t},\n\t&quot;projectId&quot;: &quot;663953ba-9e4c-4090-9e07-642c1778d467&quot;,\n\t&quot;createdOn&quot;: &quot;2022-10-10&quot;\n}\n<\/code><\/pre>\n\n\n\n<h5 id=\"h-the-project-data-class\" class=\"wp-block-heading\">The Project Data Class<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">When a <em>&#8220;project&#8221;<\/em> is retreived from the database it is stored within an data class of type <strong>Project<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>@JsonSerializable(explicitToJson: true)\nclass Project {\n String projectId;\n String name;\n String description;\n bool isComplete;\n String documentType = &#039;project&#039;;\n DateTime? dueDate;\n Warehouse? warehouse;\n\n \/\/security tracking\n String team;\n String createdBy;\n String modifiedBy;\n DateTime? createdOn;\n DateTime? modifiedOn;\n\n Project( {\n  required this.projectId,\n  required this.name,\n  required this.description,\n  required this.isComplete,\n  required this.dueDate,\n  required this.warehouse,\n  required this.team,\n  required this.createdBy,\n  required this.createdOn,\n  required this.modifiedBy,\n  required this.modifiedOn});\n\n String dueDateToString() {\n  var date = dueDate;\n  if (date != null) {\n   return &#039;${date.month}\/${date.day}\/${date.year}&#039;;\n  }\n  return &#039;&#039;;\n }\n factory Project.fromJson(Map&lt;String, dynamic&gt; json) =&gt;\n  _$ProjectFromJson(json);\n\n Map&lt;String, dynamic&gt; toJson() =&gt; _$ProjectToJson(this);\n}\n<\/code><\/pre>\n\n\n\n<h5 id=\"h-the-warehouse-class\" class=\"wp-block-heading\">The Warehouse Class<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">When a <em>&#8220;warehouse&#8221;<\/em> from a project is retreived from the database it is stored within a data class of type <strong>Warehouse<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>@JsonSerializable(explicitToJson: true)\nclass Warehouse {\n  final String warehouseId;\n  final String name;\n  final String address1;\n  final String? address2;\n  final String city;\n  final String state;\n  final String postalCode;\n  final double salesTax;\n  final double yearToDateBalance;\n  final double latitude;\n  final double longitude;\n  final List&lt;String&gt;? shippingTo;\n  final String documentType = &quot;warehouse&quot;;\n\n  const Warehouse(\n      this.warehouseId,\n      this.name,\n      this.address1,\n      this.address2,\n      this.city,\n      this.state,\n      this.postalCode,\n      this.salesTax,\n      this.yearToDateBalance,\n      this.latitude,\n      this.longitude,\n      this.shippingTo);\n\n  @override\n  String toString(){\n    return name;\n  }\n\n  factory Warehouse.fromJson(Map&lt;String, dynamic&gt; json) =&gt;\n      _$WarehouseFromJson(json);\n\n  Map&lt;String, dynamic&gt; toJson() =&gt; _$WarehouseToJson(this);\n}\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-exploring-the-query-builder-api-with-the-count-function\" class=\"wp-block-heading\">Exploring the Query Builder API with the Count Function<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Query API in Couchbase Lite is extensive.  On the Developer &#8211; Database Information screen we display the number of warehouse documents found in the warehouse database.  The <code>QueryBuilder<\/code> API along with the count function was used to calculate this number.  To see the Developer Information screen:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Launch the Invenory Application on your Android emulator or iOS simulator.<\/li>\n\n\n<li>Login in using the username <em><a href=\"mailto:demo@example.com\">demo@example.com<\/a><\/em> and password <em>P@ssw0rd12<\/em><\/li>\n\n\n<li>Click the Drawer menu icon (sometimes referred to the Hamburger icon) and tap on Developer<\/li>\n\n\n<li>Tap on the Database Information button<\/li>\n\n<\/ul>\n\n\n\n<h4 id=\"h-counting-number-of-documents-by-type\" class=\"wp-block-heading\">Counting number of documents by type<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;DeveloperInfoWidget&#8221; screen displays the count of how many documents are in the warehouse database with the type set to &#8216;warehouse&#8217;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"developer-database-info.png\" alt=\"Developer - Database Information\" title=\"#width=300px\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The DeveloperInfoWidget class obtains this information from the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/developer\/bloc\/dev_info_bloc.dart#L47\"> <strong>DevInfoBloc<\/strong><\/a> class, which emits this information.   The <code>DevInfoBloc<\/code> calls the WarehouseRepository which runs the query to calculate the count.<\/p>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>final warehouseCounter = await _warehouseRepository.count();\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/project\/data\/warehouse_repository.dart#L22\"> <strong>warehouse_repository.dart<\/strong><\/a> file and locate the <code>count<\/code> function.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>Future&lt;int&gt; count() async {\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We build the Query using the <code>QueryBuilder<\/code> API that will look for Documents that match the specified criteria.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>var count = 0;\ntry {\n const attributeCount = &#039;count&#039;;\n\n final db = _databaseProvider.warehouseDatabase;\n if (db != null) {\n  final query = QueryBuilder.createAsync()\n   .select(\n    SelectResult.expression(Function_.count(Expression.string(&quot;*&quot;)))\n   .as(attributeCount))\n  .from(DataSource.database(db))\n  .where(Expression.property(attributeDocumentType)\n  .equalTo(Expression.string(documentType))); \/\/ &lt;1&gt;\n\n  final result = await query.execute(); \/\/ &lt;2&gt;\n  final results = await result.allResults(); \/\/ &lt;3&gt;\n  count = results.first.integer(attributeCount); \/\/ &lt;4&gt;\n }\n} catch (e) {\n debugPrint(e.toString());\n}\nreturn count;\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Call the Query Builder API to create a Query<\/li>\n\n\n<li>Call the <code>execute<\/code> function to execute the query<\/li>\n\n\n<li>Call the <code>allResults<\/code> function to get all the results from the query<\/li>\n\n\n<li>We get the results by looking at the first result in the collection and getting an integer value for the key which we defined in the <code>select<\/code> clause as <code>attributeCount<\/code>.<\/li>\n\n<\/ol>\n\n\n\n<h3 id=\"h-further-exploring-the-query-builder-api-return-list-of-projects-documents\" class=\"wp-block-heading\">Further Exploring the Query Builder API &#8211; return List of Projects Documents<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Query Builder API in Couchbase Lite is extensive. In our second example, we will be using the <code>QueryBuilder<\/code> API to make a simple <em>pattern matching<\/em> query using the equalTo operator.  This example will use Live Query with dart streams.<\/p>\n\n\n\n<h4 id=\"h-fetching-project-documents\" class=\"wp-block-heading\">Fetching Project Documents<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">From the &#8220;Login&#8221; screen, when a user logs in with the proper credentials they are presented with a list of projects there team is assigned to work on.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/project\/views\/project_list_widget.dart#L14\"> <strong>project_list_widget.dart<\/strong><\/a> file and locate the <code>build<\/code> function.<\/p>\n<\/li>\n\n\n<li>\n<p>The live query is an <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/api.dart.dev\/stable\/2.18.2\/dart-async\/Stream-class.html\">AsyncListenStream<t><\/t><\/a> which is emit to state as List<project> in the <code>ProjectListBloc<\/code>.<\/project><\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>TIP<\/strong>:  Anytime documents change or are added to the database that satisify this query, the listen(change) would fire in the ProjectListBloc and the ProjectListBloc would fire the ProjectListLoadedEvent that would update state.  The <code>live query<\/code> API can dynmamically update your UI without the need for end user interaction, which will come in handy in future sections of the learning path when we review replication.<\/p>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>case DataStatus.loaded:\ncase DataStatus.changed:\n return SafeArea(\n  child: ListView.builder(\n   itemCount: state.items.length,\n   itemBuilder: (BuildContext context, int index) {\n    return GestureDetector(\n     onTap: () =&gt; {\n      routerService.routeTo(ScreenRoute(\n      routeToScreen: RouteToScreen.audits,\n      projectId: state.items[index].projectId,\n      auditListBloc:\n       BlocProvider.of&lt;AuditListBloc&gt;(context)))\n     },\n     child: ProjectCard(\n      project: state.items[index],\n      routerService: routerService));\n }));\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To see how the <code>List&lt;Project&gt;<\/code> items is created, open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/project\/bloc\/project_list_bloc.dart#L49\"> <strong>project_list_bloc.dart<\/strong><\/a> file and locate the <code>_onInitialize<\/code> method.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>Future&lt;void&gt; _onInitialize(\n      ProjectListInitializeEvent event, \n      Emitter&lt;ProjectListState&gt; emit) async {\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The bloc listens to the stream provided by the <code>ProjectRepository.getDocuments()<\/code> method.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>if (_liveQueryStream == null) {\n \/\/ &lt;1&gt;\n _liveQueryStream = await _repository.getDocuments();\n\/\/ &lt;2&gt;\n if (_liveQueryStream != null) {\n \/\/ &lt;3&gt;\n var stream = _liveQueryStream;\n emit(state.copyWith(status: DataStatus.loading));\n \/\/ &lt;4&gt;\n stream?.listen((change) async {\n  \/\/ &lt;5&gt;\n  var items = &lt;Project&gt;[];\n  \/\/ &lt;6&gt;\n  var results = await change.results.allResults();\n  \/\/ &lt;7&gt;\n  for (var result in results) {\n    \/\/ &lt;8&gt;\n    var map = result.toPlainMap();\n    var dao = ProjectDao.fromJson(map);\n   \/\/ &lt;9&gt;\n    items.add(dao.item);\n   }\n  \/\/ &lt;10&gt;\n   if (!isClosed) {\n   add(ProjectListLoadedEvent(items: items));\n   }\n  });\n\/\/await stream?.listening;\n }\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Check the _liveQueryStream to see if it is null.  If it is null, then we will create a new stream, otherwise we assume the stream is already setup and being listened to.<\/li>\n\n\n<li>Set the _liveQueryStream to the <code>AsyncListenStream<\/code> of <code>QueryChange&lt;ResultSet&gt;<\/code> returned by the <code>ProjectRepository.getDocuments()<\/code> method.<\/li>\n\n\n<li>Get a local reference to the stream for nully checking purposes.<\/li>\n\n\n<li>Listen to the stream for changes via the <code>change<\/code> parameter.<\/li>\n\n\n<li>Create local variable to hold the list of Project items.<\/li>\n\n\n<li>Get the <code>ResultSet<\/code> from the change object.<\/li>\n\n\n<li>Loop through the results in the Result Set.<\/li>\n\n\n<li>Convert the results to a plain map and then to a DOA (Data Access Object).<\/li>\n\n\n<li>Add the Project item to the list.<\/li>\n\n\n<li>If the bloc is not closed, then emit the ProjectListLoadedEvent with the list of Project items.  The bloc could be closed for several reasons including the app going to the background.  If the change fires reason while the app is in the background, this would be bad since the application is not in the foreground and the UI can&#8217;t be updated.  The <code>isClosed<\/code> check prevents this from happening.<\/li>\n\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To see how to build a live query that returns a stream, open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/project\/data\/project_repository.dart#L36\"> <strong>project_repository.dart<\/strong><\/a> file and locate the getDocuments function.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code> Future&lt;AsyncListenStream&lt;QueryChange&lt;ResultSet&gt;&gt;?&gt;? getDocuments() async {\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We first build a Query using the <code>QueryBuilder<\/code> API that will look for Documents that match the specified criteria.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-kotlin\"><code>var query = QueryBuilder.createAsync() \/\/&lt;1&gt;\n .select(SelectResult.all()) \/\/&lt;2&gt;\n .from(DataSource.database(db).as(&#039;item&#039;)) \/\/&lt;3&gt;\n .where(Expression.property(attributeDocumentType)\n  .equalTo(Expression.string(projectDocumentType))\n .and(Expression.property(&#039;team&#039;)\n  .equalTo(Expression.string(team)))); \/\/ &lt;4&gt;\nreturn query.changes(); \/\/ &lt;5&gt;\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a query using the <code>QueryBuilder<\/code> API and the createAsync method.<\/li>\n\n\n<li>The <code>SelectResult.all()<\/code> specifies that we are interested in all properties in Documents that match the specified criteria<\/li>\n\n\n<li>The DataSource.database(db).as(&#8216;item&#8217;) specified the Data Source.<\/li>\n\n\n<li>The <code>Expression<\/code> builds a <code>QueryExpression<\/code> used to find documents where the <code>documentType<\/code> property and the <code>team<\/code> properties are equal to the values passed in<\/li>\n\n\n<li>Return any changes to the documents that match this criteria by callling the <code>query.changes()<\/code> method which returns the AsyncListenStream of QueryChange<resultset>.<\/resultset><\/li>\n\n<\/ol>\n\n\n\n<h5 id=\"h-indexing-the-query\" class=\"wp-block-heading\">Indexing the Query<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Creating indexes for non-FTS based queries is optional. However, to speed up queries, you can create indexes on the properties that you would query against. Indexing is handled eagerly.<\/p>\n<\/li>\n\n\n<li>\n<p>In the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/database\/database_provider.dart#L198\"><strong>database_provider.dart<\/strong><\/a>  file, locate the <code>_createTeamDocumentTypeIndex<\/code> method.<\/p>\n<\/li>\n\n\n<li>\n<p>We create an index on the <code>documentType<\/code> and <code>team<\/code> properties of the documents in the <em>inventory<\/em> database.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>Future&lt;void&gt; _createTeamDocumentTypeIndex() async {\n final documentTypeExpression =\n  Expression.property(documentTypeAttributeName); \/\/&lt;1&gt;\n final teamExpression = Expression.property( teamAttributeName); \/\/&lt;2&gt;\n final valueIndexItems = {\n  ValueIndexItem.expression(documentTypeExpression),\n  ValueIndexItem.expression(teamExpression)\n }; \/\/&lt;3&gt;\n final index = IndexBuilder.valueIndex(valueIndexItems);  \/\/&lt;4&gt;\n var inventoryDb = inventoryDatabase; \/\/&lt;5&gt;\n if (inventoryDb != null) {         \/\/&lt;6&gt; \n  final indexes = await inventoryDb.indexes; \/\/&lt;7&gt;\n  if (!(indexes.contains(teamIndexName))) {  \/\/&lt;8&gt;\n   await inventoryDb.createIndex(teamIndexName, index); \/\/&lt;9&gt;\n  }\n }\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create the expresion for the <code>documentType<\/code> attribute.<\/li>\n\n\n<li>Create the expression for the <code>team<\/code> attribute.<\/li>\n\n\n<li>Create a collection of valueIndexItems to set the index to.<\/li>\n\n\n<li>Create the index using the IndexBuilder API.<\/li>\n\n\n<li>Get a reference to the <em>inventory<\/em> database for null checking purproses.<\/li>\n\n\n<li>Check the database to make sure it&#8217;s not null<\/li>\n\n\n<li>Get the list of indexes from the database.  We don&#8217;t want to try to create the index if it already exists.<\/li>\n\n\n<li>Check to see if the index already exists.<\/li>\n\n\n<li>If the index doesn&#8217;t exist, then create it.<\/li>\n\n<\/ol>\n\n\n\n<h3 id=\"h-query-builder-api-searching-for-warehouses-with-the-like-operator\" class=\"wp-block-heading\">Query Builder API &#8211; Searching for Warehouses with the LIKE Operator<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Query Builder API supports serveral operators including the LIKE which can be used for string matching.  We use the LIKE operator on the data editor screen for Projects to find a warehouse to add to a project.  Let&#8217;s review the code.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>NOTE<\/strong>: The like operator performs case sensitive matches.  To perform case insensitive matching, use lowercase or uppercase functions to ensure all comparators have the same case, thereby removing the case issue.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">On the Project Editor screen we provide a link to the Warehouse Section screen.  To see the Project Editor screen:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Launch the Invenory Application on your Android Emulator or iOS Simulator.<\/li>\n\n\n<li>Login in using the username <em><a href=\"mailto:demo@example.com\">demo@example.com<\/a><\/em> and password <em>P@ssw0rd12<\/em><\/li>\n\n\n<li>Click the + icon to add a Project<\/li>\n\n\n<li>Type in a name for the project on the Name field.<\/li>\n\n\n<li>Tap the button <code>Select Warehouse<\/code><\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"project_editor_screen_nowarehouse_selected.png\" alt=\"Project Editor screen\" title=\"#width=300px\"><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In the City box enter Sa<\/li>\n\n\n<li>In the State box enter Ca<\/li>\n\n\n<li>Hit the Search button<\/li>\n\n\n<li>A listing of warehouses should return that match these results<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\"select_project_warehouse.png\" alt=\"Select Project screen\" title=\"#width=300px\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s review the code for the Warehouse Section screen.<\/p>\n\n\n\n<h4 id=\"h-warehouse-selection\" class=\"wp-block-heading\">Warehouse Selection<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/project\/views\/project_editor_form.dart#L324\"> <strong>project_editor_form.dart<\/strong><\/a> file and locate the <code>_WarehouseSearchButton<\/code> class.<\/p>\n<\/li>\n\n\n<li>\n<p>The build method adds an Elevated Button<\/p>\n<\/li>\n\n\n<li>\n<p>The onPressed method adds the blocs WarehouseSearchSubmitChangeEvent when a user taps on the Search button.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>Widget build(BuildContext context) {\n return BlocBuilder&lt;WarehouseSearchBloc, WarehouseSearchState&gt;(\n builder: (context, state) {\n  if (state.status == FormEditorStatus.dataSaved ||\n   state.status == FormEditorStatus.cancelled) {\n    Navigator.of(context).pop();\n    return const Text(&#039;&#039;);\n  } else {\n   return Padding(\n    padding: const EdgeInsets.only(top: 16.0, left: 8.0, right: 8.0),\n    child: ElevatedButton(\n     onPressed: () {\n      context\n       .read&lt;WarehouseSearchBloc&gt;()\n       .add(const WarehouseSearchSubmitChangedEvent());\n      },\n     child: const Padding(\n      padding: EdgeInsets.all(8.0),\n      child: Text(\n       &quot;Search&quot;,\n       style: TextStyle(color: Colors.white, fontSize: 24.0),\n    ))),\n   );\n  }\n });\n}\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/project\/bloc\/warehouse_search_bloc.dart\"> <strong>warehouse_search_bloc.dart<\/strong><\/a> file and locate the <code>_onSubmitted<\/code> method.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>FutureOr&lt;void&gt; _onSubmitted(\n WarehouseSearchSubmitChangedEvent event, \n Emitter&lt;WarehouseSearchState&gt; emit) async {\n if (state.searchCity.isNotEmpty) { \/\/ &lt;1&gt;\n \/\/get warehouse list from repository\n try {\n  var items =\n   await _repository.search(state.searchCity, state.searchState);  \/\/ &lt;2&gt;\n  if (items.isNotEmpty) {\n   emit(state.copyWith(\n    error: &#039;&#039;,\n    status: FormEditorStatus.dataLoaded,\n    warehouses: items)); \/\/&lt;3&gt;\n   } else {\n   emit(state.copyWith(\n    error: &#039;No warehouses found matching criteria.&#039;,\n    status: FormEditorStatus.error)); \/\/&lt;4&gt;\n   }\n  } catch (e) {\n  emit(state.copyWith(\n   error: e.toString(), status: FormEditorStatus.error));\n  }\n } else {\n emit(state.copyWith(\n  error: &#039;Error - City can&#039;t be blank&#039;,\n  status: FormEditorStatus.error));\n }\n}\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Check to make sure that the city field is not empty.  If it is, then we can&#8217;t search for a warehouse as city is a required field.<\/li>\n\n\n<li>Call the repository to search for warehouses.  The repository will use the Query Builder API to search for warehouses.<\/li>\n\n\n<li>If the search returns a list of warehouses, then emit the state with the list of warehouses.<\/li>\n\n\n<li>If not, then emit the state with an error message.<\/li>\n\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/github.com\/couchbase-examples\/flutter_cbl_learning_path\/blob\/main\/src\/lib\/features\/project\/data\/warehouse_repository.dart#L72\"> <strong>warehouse_repository.dart<\/strong><\/a> file and locate the <code>search<\/code> method.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>Future&lt;List&lt;Warehouse&gt;&gt; search(String searchCity, String? searchState) async {\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This method does not use live query, so we return a List of Warehouse objects.<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-dart\"><code>List&lt;Warehouse&gt; items = [];\n try {\n  var db = _databaseProvider.warehouseDatabase;\n  if (db != null) {\n   \/\/ &lt;1&gt;\n   var whereExpression = Function_\n    .lower(Expression.property(attributeDocumentType))\n    .equalTo(Expression.string(documentType));\n   \/\/ &lt;2&gt;\n   var cityExpression = Function_\n    .lower(Expression.property(cityAttributeName))\n    .like(Expression.string(&quot;%${searchCity.toLowerCase()}%&quot;));\n\n   whereExpression = whereExpression.and(cityExpression);\n\n   \/\/ &lt;3&gt;\n   if(searchState != null &amp;&amp; searchState.isNotEmpty){\n    var stateExpression = Function_.lower(Expression.property(stateAttributeName))\n     .like(Expression.string(&quot;%${searchState.toLowerCase()}%&quot;));\n\n    whereExpression = whereExpression.and(stateExpression);\n   }\n\n   \/\/ &lt;4&gt;\n  var query = QueryBuilder.createAsync()\n   .select(SelectResult.all())\n   .from(DataSource.database(db).as(&#039;warehouse&#039;))\n   .where(whereExpression);\n\n  \/\/ &lt;5&gt;\n  var result = await query.execute();\n  var results = await result.allResults();\n\n  \/\/ &lt;6&gt;\n  for (var r in results) {\n   var map = r.toPlainMap();\n   var warehouseDoa = WarehouseDao.fromJson(map);\n   items.add(warehouseDoa.warehouse);\n   }\n  }  \n } catch (e) {\n  debugPrint(e.toString());\n }\nreturn items;\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a query expression off the type attribute and use the equalTo function to pass in the documentType value.  This makes sure we only match warehouse documents.<\/li>\n\n\n<li>Create a query expression off the city attribute and use the like function to pass in the searchCity value.  We make sure to use the searchCity toLowerCase method to make the search case insensitive.<\/li>\n\n\n<li>If the searchState value is not null, then we will create a query expression off the state attribute and use the like function to pass in the searchState value.  We make sure to use the searchState toLowerCase method to make the search case insensitive.<\/li>\n\n\n<li>We will build a query using the QueryBuilder API to select all the results from the database and pass in our whereQueryExpression with our like statement(s).<\/li>\n\n\n<li>We loop through all the results and add them to the warehouses list that is then returned.<\/li>\n\n<\/ol>\n\n\n\n<h3 id=\"h-learn-more\" class=\"wp-block-heading\">Learn More<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Congratulations on completing this step of our learning path!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This step of the learning path walked you through the Query Builder API in Couchbase Lite and used it to return documents from the database and we looked at calling the Query API built-in count function. Check out the following links for further documenation and continue on to the next step to learn more about how to use Query Builder with SQL++ syntax.<\/p>\n\n\n\n<h4 id=\"h-references\" class=\"wp-block-heading\">References<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/querybuilder.html\">Documentation: Querybuilder<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/querybuilder.html#lbl-like-ops\">Documentation: Querybuilder &#8211; Like Operator<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/mobile\/3.0.0\/couchbase-lite-android\/com\/couchbase\/lite\/Function.html\">API Documentation: Querybuilder &#8211; Functions<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-resultsets.html\">Documentation: Result Sets<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-live.html\">Documentation: Live Query &#8211; Working with Queries<\/a><\/li>\n\n\n<li><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https:\/\/docs.couchbase.com\/couchbase-lite\/current\/android\/query-troubleshooting.html\">Documentation: Query Troubleshooting\n<\/a><\/li>\n\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Couchbase Lite brings powerful querying and Full-Text-Search(FTS) capabilties to the edge. The query builder interface is based on SQL++, Couchbase\u2019s declarative query language that extends SQL for JSON. If you are familiar with SQL, you will feel right at home with the semantics of the new API. The query builder API is designed using [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_acf":"","footnotes":""},"tutorial-languages":[589],"tutorial-tags":[591],"tutorial-technologies":[585],"tutorial-types":[555],"class_list":["post-10267","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-dart","tutorial-tags-flutter","tutorial-technologies-mobile","tutorial-types-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Couchbase Lite Query Builder Engine with Dart and Flutter - Couchbase<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Couchbase Lite Query Builder Engine with Dart and Flutter\" \/>\n<meta property=\"og:description\" content=\"Introduction Couchbase Lite brings powerful querying and Full-Text-Search(FTS) capabilties to the edge. The query builder interface is based on SQL++, Couchbase\u2019s declarative query language that extends SQL for JSON. If you are familiar with SQL, you will feel right at home with the semantics of the new API. The query builder API is designed using [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/\" \/>\n<meta property=\"og:site_name\" content=\"Couchbase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Couchbase\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2548\" \/>\n\t<meta property=\"og:image:height\" content=\"1171\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@couchbase\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"15 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/dart-flutter-query-builder\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/dart-flutter-query-builder\\\/\",\"name\":\"Couchbase Lite Query Builder Engine with Dart and Flutter - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\"},\"datePublished\":\"2023-06-23T08:43:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/dart-flutter-query-builder\\\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/dart-flutter-query-builder\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/dart-flutter-query-builder\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Couchbase Lite Query Builder Engine with Dart and Flutter\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"width\":1129,\"height\":1129,\"caption\":\"Couchbase\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Couchbase\\\/\",\"https:\\\/\\\/x.com\\\/couchbase\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/CouchbaseServer\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/couchbase\\\/\",\"https:\\\/\\\/github.com\\\/couchbase\\\/\",\"https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Couchbase,_Inc.\"],\"description\":\"Couchbase is a database software company headquartered in San Jose, California, providing an operational data platform for AI used by hundreds of global enterprises.\",\"legalName\":\"Couchbase, Inc.\",\"foundingDate\":\"2011-01-01\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Couchbase Lite Query Builder Engine with Dart and Flutter - Couchbase","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/","og_locale":"it_IT","og_type":"article","og_title":"Couchbase Lite Query Builder Engine with Dart and Flutter","og_description":"Introduction Couchbase Lite brings powerful querying and Full-Text-Search(FTS) capabilties to the edge. The query builder interface is based on SQL++, Couchbase\u2019s declarative query language that extends SQL for JSON. If you are familiar with SQL, you will feel right at home with the semantics of the new API. The query builder API is designed using [&hellip;]","og_url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/","og_site_name":"Couchbase","article_publisher":"https:\/\/www.facebook.com\/Couchbase\/","og_image":[{"width":2548,"height":1171,"url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@couchbase","twitter_misc":{"Est. reading time":"15 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/","url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/","name":"Couchbase Lite Query Builder Engine with Dart and Flutter - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/it\/#website"},"datePublished":"2023-06-23T08:43:43+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/dart-flutter-query-builder\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/"},{"@type":"ListItem","position":2,"name":"Couchbase Lite Query Builder Engine with Dart and Flutter"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/it\/#website","url":"https:\/\/www.couchbase.com\/it\/","name":"Couchbase","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/it\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/it\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/it\/#organization","name":"Couchbase","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/it\/","logo":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.couchbase.com\/it\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","contentUrl":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","width":1129,"height":1129,"caption":"Couchbase"},"image":{"@id":"https:\/\/www.couchbase.com\/it\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Couchbase\/","https:\/\/x.com\/couchbase","https:\/\/www.youtube.com\/c\/CouchbaseServer","https:\/\/www.linkedin.com\/company\/couchbase\/","https:\/\/github.com\/couchbase\/","https:\/\/en.wikipedia.org\/wiki\/Couchbase,_Inc."],"description":"Couchbase \u00e8 una societ\u00e0 di software per database con sede a San Jose, in California, che fornisce una piattaforma operativa per i dati utilizzata da centinaia di aziende globali.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10267\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/media?parent=10267"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-languages?post=10267"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-tags?post=10267"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-technologies?post=10267"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-types?post=10267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}