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
+22-21Lines changed: 22 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,8 @@ However, the ObjectBox core supports many more features, e.g. queries, indexing,
9
9
To bring all these features to Dart, we're asking the community to help out. PRs are more than welcome!
10
10
The ObjectBox team will try its best to guide you and answer questions.
11
11
12
-
### Open Development Process
13
-
12
+
Contributing
13
+
------------------
14
14
This project is completely managed here on GitHub using its [issue tracker](https://github.com/objectbox/objectbox-dart/issues) and [project boards](https://github.com/objectbox/objectbox-dart/projects).
15
15
16
16
To prepare an upcoming version, we create a (Kanban like) board for it.
@@ -24,30 +24,36 @@ Issues on the board are referred to as "cards" which move from left to right:
24
24
* Once a task is considered complete (e.g. PR is made), put it in the "Review" column.
25
25
* Once another person had a look and is happy, the task is finally moved to "Done"
26
26
27
-
Anyone can contribute in this process. Look for tasks having a **"help wanted"** tag.
28
-
29
-
### Feedback
27
+
Anyone can contribute, be it by coding, improving docs or just proposing a new feature.
28
+
Look for tasks having a **"help wanted"** tag.
30
29
30
+
#### Feedback
31
31
Also, please let us know your feedback by opening an issue:
32
32
for example, if you experience errors or if you have ideas for how to improve the API.
33
33
Thanks!
34
34
35
+
#### Code style
36
+
Please make sure that all code submitted via Pull Request is formatted using `dartfmt -l 120`.
37
+
You can configure your IDE to do this automatically, e.g. VS Code needs the project-specific settings
38
+
`"editor.defaultFormatter": "Dart-Code.dart-code"` and `"dart.lineLength": 120`.
39
+
35
40
Getting started
36
41
---------------
37
42
To try out the demo code in this repository, follow these steps:
38
43
39
-
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) 0.7` (answer Y when it asks about installing to /usr/lib).
`bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-c/master/download.sh) 0.7` (answer Y when it asks about installing to /usr/lib).
40
46
2. Back in this repository, run `pub get`.
41
-
3. Execute `pub run build_runner build`. This regenerates the ObjectBox model to make it usable in Dart (i.e. the file `test/test.g.dart`) and is necessary each time you add or change a class annotated with `@Entity(...)`.
42
-
4. Finally run `pub run test test/test.dart` to run the unit tests.
47
+
3. Execute `pub run build_runner build`. This regenerates the ObjectBox model to make it usable in Dart
48
+
(i.e. the file `test/test.g.dart`) and is necessary each time you add or change a class annotated with `@Entity(...)`.
49
+
4. Finally run `pub run test` to run the unit tests.
43
50
44
51
Dart integration
45
52
----------------
46
53
In general, Dart class annotations are used to mark classes as ObjectBox entities and provide meta information.
47
54
Note that right now, only a limited set of types is supported; this will be expanded upon in the near future.
48
-
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.
49
-
50
-
All non-annotated class instance variables are ignored by ObjectBox.
55
+
Entity IDs and UIDs that are defined in their respective annotations need to be unique across all entities, while
56
+
property IDs only need to be unique in their respective entity; property UIDs also need to be globally unique.
51
57
52
58
### Object IDs
53
59
@@ -57,20 +63,15 @@ New (not yet persisted) objects typically have _Id_ value of `0` or `null`: call
57
63
58
64
### Example
59
65
60
-
*Note:* specifying the (meta model) IDs in annotations manually is a temporary quick solution.
61
-
In a later version, you won't have to do this the and e.g. `@Property(id: 2, uid: 1002)` can be dropped completely.
62
-
As specified in step 3 of the _Getting started_ section, Dart's _build\_runner_ and _source\_gen_ are currently used and the generator will be extended to automatically manage the meta model IDs in the future.
63
-
64
66
```dart
65
-
import "../lib/objectbox.dart";
66
-
part "test.g.dart";
67
+
import "package:objectbox/objectbox.dart";
68
+
part "note.g.dart";
67
69
68
-
@Entity(id: 1, uid: 1)
70
+
@Entity()
69
71
class Note {
70
-
@Id(id: 1, uid: 1001) // automatically always 'int' in Dart code and 'Long' in ObjectBox
72
+
@Id() // automatically always 'int' in Dart code and 'Long' in ObjectBox
71
73
int id;
72
74
73
-
@Property(id: 2, uid: 1002)
74
75
String text;
75
76
76
77
Note(); // empty default constructor needed
@@ -83,7 +84,7 @@ In your main function, you can then create a _store_ which needs an array of you
83
84
Finally, you need a _box_, representing the interface for objects of one specific entity type.
0 commit comments