Isar database setup in Flutter app

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Isar database setup in Flutter app
Medium
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Setting up Isar Database in Flutter Application

Isar is what Hive aspired to become. A full-featured NoSQL database with support for indexes, complex queries, transactions, and reactive streams. Written in Rust with FFI bindings for Dart, providing performance comparable to SQLite with a significantly more convenient API.

Suitable for projects where Hive hits limitations: you need queries across multiple fields, sorting, database-side filtering, or reactive UI updates when data changes.

Connection and Schema

dependencies:
  isar: ^3.1.0+1
  isar_flutter_libs: ^3.1.0+1

dev_dependencies:
  isar_generator: ^3.1.0+1
  build_runner: ^2.4.6

Model with annotations:

@collection
class Product {
  Id id = Isar.autoIncrement;

  @Index(type: IndexType.value)
  late String category;

  @Index(composite: [CompositeIndex('price')])
  late String name;

  late double price;
  late bool inStock;
}

Code generation: flutter pub run build_runner build. Creates product.g.dart with collection extensions.

Initialization:

final isar = await Isar.open(
  [ProductSchema],
  directory: (await getApplicationDocumentsDirectory()).path,
);

Queries — The Main Advantage

This is where Isar far surpasses Hive:

// Filtering + sorting + limit
final products = await isar.products
  .filter()
  .categoryEqualTo('electronics')
  .and()
  .inStockEqualTo(true)
  .sortByPriceDesc()
  .limit(20)
  .findAll();

Reactive stream — UI updates when data changes:

Stream<List<Product>> watchProducts() {
  return isar.products
    .filter()
    .inStockEqualTo(true)
    .watch(fireImmediately: true);
}

Instead of StreamBuilder with periodic polling, you get a subscription to specific query changes. Clean and efficient.

Transactions. For writing multiple related objects, use writeTxn:

await isar.writeTxn(() async {
  await isar.products.putAll(newProducts);
  await isar.categories.put(updatedCategory);
});

Without a transaction, each put is a separate write operation. With a transaction, it's atomic.

Limitations to Know

Isar does not support the Web platform (unlike Hive). If your project targets Flutter Web, use Hive or ObjectBox. On Desktop (Windows, macOS, Linux), Isar works via isar_flutter_libs.

Data schema is versioned: when changing a model, specify @collection(accessor: 'products') and configure migration via IsarSchema.migration. Forgotten migration on app update causes database open failure.

Timeline

Isar setup with 3–5 collections, indexes, and basic queries: 1–2 days. With reactive streams, BLoC/Riverpod integration, and migration strategy: 2–4 days. Cost calculated individually after analyzing your data model.