|
2 | 2 | // EntityGenerator |
3 | 3 | // ************************************************************************** |
4 | 4 |
|
5 | | -Map<int, ModelEntity> _allOBXModelEntities; |
6 | | - |
7 | | -void _loadOBXModelEntities() { |
8 | | - _allOBXModelEntities = {}; |
9 | | - ModelInfo modelInfo = ModelInfo.fromMap({ |
10 | | - "_note1": |
11 | | - "KEEP THIS FILE! Check it into a version control system (VCS) like git.", |
12 | | - "_note2": |
13 | | - "ObjectBox manages crucial IDs for your object model. See docs for details.", |
14 | | - "_note3": |
15 | | - "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.", |
16 | | - "entities": [ |
17 | | - { |
18 | | - "id": "1:1234", |
19 | | - "lastPropertyId": "2:4321", |
20 | | - "name": "SingleEntity", |
21 | | - "properties": [ |
22 | | - {"id": "1:5678", "name": "id", "type": 6, "flags": 1}, |
23 | | - {"id": "2:4321", "name": "texta", "type": 9} |
24 | | - ] |
25 | | - } |
26 | | - ], |
27 | | - "lastEntityId": "1:1234", |
28 | | - "lastIndexId": "0:0", |
29 | | - "lastRelationId": "0:0", |
30 | | - "lastSequenceId": "0:0", |
31 | | - "modelVersion": 5, |
32 | | - "modelVersionParserMinimum": 5, |
33 | | - "retiredEntityUids": [], |
34 | | - "retiredIndexUids": [], |
35 | | - "retiredPropertyUids": [], |
36 | | - "retiredRelationUids": [], |
37 | | - "version": 1 |
38 | | - }); |
39 | | - modelInfo.entities.forEach((e) => _allOBXModelEntities[e.id.uid] = e); |
40 | | -} |
41 | | - |
42 | | -ModelEntity _getOBXModelEntity(int entityUid) { |
43 | | - if (_allOBXModelEntities == null) _loadOBXModelEntities(); |
44 | | - if (!_allOBXModelEntities.containsKey(entityUid)) { |
45 | | - throw Exception("entity uid missing in objectbox-model.json: $entityUid"); |
46 | | - } |
47 | | - return _allOBXModelEntities[entityUid]; |
48 | | -} |
49 | | - |
50 | 5 | ModelEntity _SingleEntity_OBXModelGetter() { |
51 | | - return _getOBXModelEntity(1234); |
| 6 | + return ModelEntity.fromMap({ |
| 7 | + "id": "1:1234", |
| 8 | + "lastPropertyId": "2:4321", |
| 9 | + "name": "SingleEntity", |
| 10 | + "properties": [ |
| 11 | + {"id": "1:5678", "name": "id", "type": 6, "flags": 1}, |
| 12 | + {"id": "2:4321", "name": "texta", "type": 9} |
| 13 | + ] |
| 14 | + }); |
52 | 15 | } |
53 | 16 |
|
54 | 17 | SingleEntity _SingleEntity_OBXBuilder(Map<String, dynamic> members) { |
|
0 commit comments