|
|
@@ -9,28 +9,37 @@ import 'package:objectbox/internal.dart'; // generated code can access "internal
|
|
|
import 'package:objectbox/objectbox.dart';
|
|
|
import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart';
|
|
|
|
|
|
-import 'entity/login.dart';
|
|
|
+import 'entities/profile.dart';
|
|
|
|
|
|
export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file
|
|
|
|
|
|
final _entities = <ModelEntity>[
|
|
|
ModelEntity(
|
|
|
- id: const IdUid(1, 3444477729893015694),
|
|
|
- name: 'User',
|
|
|
- lastPropertyId: const IdUid(2, 2305308568754167021),
|
|
|
+ id: const IdUid(2, 1438354990151910015),
|
|
|
+ name: 'Profile',
|
|
|
+ lastPropertyId: const IdUid(6, 4818206049188692305),
|
|
|
flags: 0,
|
|
|
properties: <ModelProperty>[
|
|
|
ModelProperty(
|
|
|
- id: const IdUid(1, 5463014948149082651),
|
|
|
+ id: const IdUid(1, 3873481118333862410),
|
|
|
name: 'id',
|
|
|
type: 6,
|
|
|
flags: 1),
|
|
|
ModelProperty(
|
|
|
- id: const IdUid(2, 2305308568754167021),
|
|
|
+ id: const IdUid(2, 9078004558710481468),
|
|
|
+ name: 'theme',
|
|
|
+ type: 6,
|
|
|
+ flags: 0),
|
|
|
+ ModelProperty(
|
|
|
+ id: const IdUid(3, 7647214962273172849),
|
|
|
name: 'username',
|
|
|
type: 9,
|
|
|
- flags: 2080,
|
|
|
- indexId: const IdUid(1, 2185831944762227781))
|
|
|
+ flags: 0),
|
|
|
+ ModelProperty(
|
|
|
+ id: const IdUid(4, 5923665807684456265),
|
|
|
+ name: 'isLogin',
|
|
|
+ type: 1,
|
|
|
+ flags: 0)
|
|
|
],
|
|
|
relations: <ModelRelation>[],
|
|
|
backlinks: <ModelBacklink>[])
|
|
|
@@ -56,32 +65,41 @@ Future<Store> openStore(
|
|
|
ModelDefinition getObjectBoxModel() {
|
|
|
final model = ModelInfo(
|
|
|
entities: _entities,
|
|
|
- lastEntityId: const IdUid(1, 3444477729893015694),
|
|
|
+ lastEntityId: const IdUid(2, 1438354990151910015),
|
|
|
lastIndexId: const IdUid(1, 2185831944762227781),
|
|
|
lastRelationId: const IdUid(0, 0),
|
|
|
lastSequenceId: const IdUid(0, 0),
|
|
|
- retiredEntityUids: const [],
|
|
|
+ retiredEntityUids: const [3444477729893015694],
|
|
|
retiredIndexUids: const [],
|
|
|
- retiredPropertyUids: const [],
|
|
|
+ retiredPropertyUids: const [
|
|
|
+ 5463014948149082651,
|
|
|
+ 2305308568754167021,
|
|
|
+ 649621747167423523,
|
|
|
+ 4818206049188692305
|
|
|
+ ],
|
|
|
retiredRelationUids: const [],
|
|
|
modelVersion: 5,
|
|
|
modelVersionParserMinimum: 5,
|
|
|
version: 1);
|
|
|
|
|
|
final bindings = <Type, EntityDefinition>{
|
|
|
- Login: EntityDefinition<Login>(
|
|
|
+ Profile: EntityDefinition<Profile>(
|
|
|
model: _entities[0],
|
|
|
- toOneRelations: (Login object) => [],
|
|
|
- toManyRelations: (Login object) => {},
|
|
|
- getId: (Login object) => object.id,
|
|
|
- setId: (Login object, int id) {
|
|
|
+ toOneRelations: (Profile object) => [],
|
|
|
+ toManyRelations: (Profile object) => {},
|
|
|
+ getId: (Profile object) => object.id,
|
|
|
+ setId: (Profile object, int id) {
|
|
|
object.id = id;
|
|
|
},
|
|
|
- objectToFB: (Login object, fb.Builder fbb) {
|
|
|
- final usernameOffset = fbb.writeString(object.username);
|
|
|
- fbb.startTable(3);
|
|
|
+ objectToFB: (Profile object, fb.Builder fbb) {
|
|
|
+ final usernameOffset = object.username == null
|
|
|
+ ? null
|
|
|
+ : fbb.writeString(object.username!);
|
|
|
+ fbb.startTable(7);
|
|
|
fbb.addInt64(0, object.id);
|
|
|
- fbb.addOffset(1, usernameOffset);
|
|
|
+ fbb.addInt64(1, object.theme);
|
|
|
+ fbb.addOffset(2, usernameOffset);
|
|
|
+ fbb.addBool(3, object.isLogin);
|
|
|
fbb.finish(fbb.endTable());
|
|
|
return object.id;
|
|
|
},
|
|
|
@@ -89,10 +107,13 @@ ModelDefinition getObjectBoxModel() {
|
|
|
final buffer = fb.BufferContext(fbData);
|
|
|
final rootOffset = buffer.derefObject(0);
|
|
|
|
|
|
- final object = Login(
|
|
|
- username:
|
|
|
- const fb.StringReader().vTableGet(buffer, rootOffset, 6, ''))
|
|
|
- ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0);
|
|
|
+ final object = Profile()
|
|
|
+ ..id = const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0)
|
|
|
+ ..theme = const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0)
|
|
|
+ ..username =
|
|
|
+ const fb.StringReader().vTableGetNullable(buffer, rootOffset, 8)
|
|
|
+ ..isLogin =
|
|
|
+ const fb.BoolReader().vTableGet(buffer, rootOffset, 10, false);
|
|
|
|
|
|
return object;
|
|
|
})
|
|
|
@@ -101,11 +122,20 @@ ModelDefinition getObjectBoxModel() {
|
|
|
return ModelDefinition(model, bindings);
|
|
|
}
|
|
|
|
|
|
-/// [Login] entity fields to define ObjectBox queries.
|
|
|
-class User_ {
|
|
|
- /// see [Login.id]
|
|
|
- static final id = QueryIntegerProperty<Login>(_entities[0].properties[0]);
|
|
|
+/// [Profile] entity fields to define ObjectBox queries.
|
|
|
+class Profile_ {
|
|
|
+ /// see [Profile.id]
|
|
|
+ static final id = QueryIntegerProperty<Profile>(_entities[0].properties[0]);
|
|
|
+
|
|
|
+ /// see [Profile.theme]
|
|
|
+ static final theme =
|
|
|
+ QueryIntegerProperty<Profile>(_entities[0].properties[1]);
|
|
|
+
|
|
|
+ /// see [Profile.username]
|
|
|
+ static final username =
|
|
|
+ QueryStringProperty<Profile>(_entities[0].properties[2]);
|
|
|
|
|
|
- /// see [Login.username]
|
|
|
- static final username = QueryStringProperty<Login>(_entities[0].properties[1]);
|
|
|
+ /// see [Profile.isLogin]
|
|
|
+ static final isLogin =
|
|
|
+ QueryBooleanProperty<Profile>(_entities[0].properties[3]);
|
|
|
}
|