You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-16Lines changed: 24 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,37 @@
1
-
# ObjectBox for Dart/Flutter
2
-
ObjectBox for Dart is a standalone database storing Dart objects locally with strong ACID semantics.
3
-
4
-
## Help wanted
5
-
ObjectBox for Dart is still in a prototype stage supporting only the most basic database tasks like putting and getting objects.
6
-
The ObjectBox core however supports many more features, e.g. queries, indexing, async operations, transaction control.
1
+
ObjectBox for Dart/Flutter
2
+
==========================
3
+
ObjectBox for Dart is a standalone database storing Dart objects locally, with strong ACID semantics.
4
+
5
+
Help wanted
6
+
-----------
7
+
ObjectBox for Dart is still in a prototype stage supporting only the most basic database tasks, like putting and getting objects.
8
+
However, the ObjectBox core supports many more features, e.g. queries, indexing, async operations, transaction control.
7
9
To bring all these features to Dart, we're asking the community to help out. PRs are more than welcome!
8
10
The ObjectBox team will try its best to guide you and answer questions.
9
11
10
-
Also, please let us know your feedback and open an issue: for example, if you experience errors or if you have ideas to how to improve the API.
12
+
Also, please let us know your feedback by opening an issue:
13
+
for example, if you experience errors or if you have ideas for how to improve the API.
11
14
Thanks!
12
15
13
-
## Getting started
14
-
To try out the demo code in this repository, do the following:
16
+
Getting started
17
+
---------------
18
+
To try out the demo code in this repository, follow these:
19
+
15
20
1. Install [objectbox-c](https://github.com/objectbox/objectbox-c) system-wide: `bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-c/master/download.sh)` (answer Y when it asks about installing to /usr/lib).
16
21
2. Back in this repository, run `pub get` to download all Dart dependencies.
17
22
3. Finally run `dart test/test.dart` to start the demo script.
18
23
Note that, as fairly recent language features are used, the minimal required Dart version is 2.2.2.
19
24
20
-
## Dart integration
21
-
In general, Dart class annotations are used in order to design ObjectBox entities in the most intuitive way possible.
25
+
Dart integration
26
+
----------------
27
+
In general, Dart class annotations are used to mark classes as ObjectBox entities and provide meta information.
22
28
Note that right now, only a limited set of types is supported; this will be expanded upon in the near future.
23
-
Entity IDs and UIDs defined in their respective annotations need to be unique across all entities, while property IDs only need to be unique in their respective entity; property UIDs also need to be globally unique.
29
+
Entity IDs and UIDs that are defined in their respective annotations need to be unique across all entities, while property IDs only need to be unique in their respective entity; property UIDs also need to be globally unique.
24
30
25
31
All non-annotated class instance variables are ignored by ObjectBox.
26
32
27
33
### Object IDs
34
+
28
35
Each entity is required to have an _Id_ property of type _Long_.
29
36
Already persisted entities have an ID greater or equal to 1.
30
37
New (not yet persisted) objects typically have _Id_ value of `0` or `null`: calling `Box.put` automatically assigns a new ID to the object.
@@ -50,7 +57,7 @@ class Note {
50
57
```
51
58
52
59
In your main function, you can then create a _store_ which needs an array of your entity classes to be constructed.
53
-
Finally, you need a _box_, i.e. an interface to objects of one specific entity type contained in the store it is connected to.
60
+
Finally, you need a _box_, representing the interface for objects of one specific entity type.
ObjectBox offers a [C API](https://github.com/objectbox/objectbox-c) which can be called by [Dart FFI](https://dart.dev/server/c-interop).
69
-
The C API is is also used by [ObjectBox Go](https://github.com/objectbox/objectbox-go) and the minimal [Python binding](https://github.com/objectbox/objectbox-python) (the [Swift binding](https://github.com/objectbox/objectbox-swift) will soon follow).
77
+
The C API is is also used by the ObjectBox language bindings for [Go](https://github.com/objectbox/objectbox-go), [Swift](https://github.com/objectbox/objectbox-swift), and [Python](https://github.com/objectbox/objectbox-python).
70
78
These language bindings currently serve as an example for this Dart implementation.
71
79
72
80
Internally, ObjectBox uses [FlatBuffers](https://google.github.io/flatbuffers/) to store objects.
73
-
There are two basic ways make the conversion: generated binding code or implicit FlatBuffers conversion.
81
+
There are two basic ways to make the conversion: generated binding code, or implicit FlatBuffers conversion.
74
82
In order to require as little setup as possible and to define entity classes directly in Dart code, the latter is used in this binding.
0 commit comments