objectbox 1.5.0 icon indicating copy to clipboard operation
objectbox: ^1.5.0 copied to clipboard

Flutter database for super-fast NoSQL ACID compliant object persistence.

ObjectBox

Getting StartedDocumentationExample AppsIssues

Build and test pub.dev package Apache 2.0 license Follow @ObjectBox_io

Flutter database for Dart-native objects 💙 #

🙌 Your opinion matters to us! Please fill in this 2-minute Anonymous Feedback Form.

ObjectBox Flutter database is a great option for storing data in your cross-platform apps. It uses minimal CPU, memory and battery, which makes it an ideal choice for mobile and IoT devices. It is made for efficient data access and is 10x faster than any alternative. See the performance benchmarks below. No need to learn SQL, as our NoSQL database uses pure Dart API that is easy to work with and can be integrated in minutes. Apart from that, we built a data synchronization solution that allows you to choose which objects to sync when and therefore keep your cloud costs low.

Features #

🏁 High performance - improving response rates and enabling real-time applications.
🪂 ACID compliant - Atomic, Consistent, Isolated, Durable.
💻 Multiplatform - Android, iOS, macOS, Linux, Windows.
🌱 Scalable - grows with your app, handling millions of objects with ease.

🔗 Relations - object links / relationships are built-in.
💐 Queries - filter data as needed, even across relations.
🦮 Statically typed - compile time checks & optimizations.
📃 Schema migration - change your model with confidence.

Oh, and there is one more thing... 😮 Data Sync - keeps data in sync offline or online, between devices and servers.

Sneak peek - persist Dart objects with ObjectBox #

@Entity()
class Person {
  int id;

  String firstName;
  String lastName;

  Person({this.id = 0, required this.firstName, required this.lastName});
}

final store = await openStore(); 
final box = store.box<Person>();

var person = Person(firstName: 'Joe', lastName: 'Green');

final id = box.put(person);  // Create

person = box.get(id)!;       // Read

person.lastName = "Black";
box.put(person);             // Update

box.remove(person.id);       // Delete

// find all people whose name start with letter 'J'
final query = box.query(Person_.firstName.startsWith('J')).build();
final people = query.find();  // find() returns List<Person>

Getting Started #

Check out our new Getting Started guide.

We also have three video tutorials, each featuring a different example app:

Depending on if you are building a Flutter or Dart-only app, follow the steps below to start using ObjectBox.

Flutter #

Add these dependencies to your pubspec.yaml:

dependencies:
  objectbox: ^1.5.0
  objectbox_flutter_libs: any
  # for ObjectBox Sync use this dependency instead:
  # objectbox_sync_flutter_libs: any

dev_dependencies:
  build_runner: ^2.0.0
  objectbox_generator: any
  • Install the packages: flutter pub get

  • For iOS: in the Flutter Runner Xcode project

    • increase the deployment target to at least iOS 11 and,
    • under Architectures, replace ${ARCHS_STANDARD} with arm64 (or $ARCHS_STANDARD_64_BIT). See FAQ for details.
  • For sandboxed macOS apps: specify an application group. Check all macos/Runner/*.entitlements files if they contain a <dict> section with correct group ID info. Change the string value to the DEVELOPMENT_TEAM found in Xcode settings, plus an application-specific suffix, for example:

    <key>com.apple.security.application-groups</key>
    <array>
      <string>FGDTDLOBXDJ.demo</string>
    </array>
    

    Next, in the app code, pass the same string when opening the Store, for example: openStore(macosApplicationGroup: 'FGDTDLOBXDJ.demo').
    Note: Pick a short group identifier; there's an internal limit in macOS that requires the complete string to be 19 characters or fewer.

  • For Sync + Android: in android/app/build.gradle set minSdkVersion 21 in section android -> defaultConfig.

  • In order to run Flutter unit tests locally on your machine, install the native ObjectBox library on your host machine (same as you would if you developed for Dart native, as described in the next section):

    bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
    

Continue with the examples README to learn how to create entities and use the ObjectBox API.

Dart Native #

Add these dependencies to your pubspec.yaml:

dependencies:
  objectbox: ^1.5.0

dev_dependencies:
  build_runner: ^2.0.0
  objectbox_generator: any
  • Install the packages: dart pub get

  • Install objectbox-c system-wide (use "Git bash" on Windows):

    bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh)
    

    To install ObjectBox Sync variant of the native library, pass --sync argument to the script:

    bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-dart/main/install.sh) --sync
    

Continue with the examples README to learn how to create entities and use the ObjectBox API.

Flutter Database Performance Benchmarks #

We tested across the four main database operations, CRUD (create, read, update, delete). Each test was run multiple times and executed manually outside of the measured time. Data preparation and evaluation were also done outside of the measured time.

Here are the benchmarks for ObjectBox vs sqflite vs Hive 👇

You can run these yourself using our objectbox-dart-performance Flutter benchmark app.

Do you 💙 ObjectBox? #

We strive to bring joy to Flutter developers and appreciate all kind of feedback, both positive and negative. What do you love? What's amiss? Where do you struggle in everyday app development?

We're looking forward to receiving your comments and requests:

  • Add GitHub issues
  • Upvote issues you find important by hitting the 👍/+1 reaction button
  • Fill in the feedback form to help us improve our products
  • Drop us a line on Twitter via @ObjectBox_io
  • ⭐ us, if you like what you see

Thank you! 🙏

Keep in touch: For general news on ObjectBox, check our blog!

FAQ #

See the FAQ and Troubleshooting pages.

See also #

License #

Copyright 2019-2022 ObjectBox Ltd. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

642
likes
130
pub points
96%
popularity

Publisher

verified publisher iconobjectbox.io

Flutter database for super-fast NoSQL ACID compliant object persistence.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

Icon for licenses.Apache-2.0 (LICENSE)

Dependencies

collection, ffi, flat_buffers, meta, path

More

Packages that depend on objectbox