feat: save module
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
part 'target_page.g.dart';
|
||||
|
||||
@HiveType(typeId: targetPageTypeId)
|
||||
class TargetPage extends HiveObject {
|
||||
@HiveField(0)
|
||||
String? route;
|
||||
|
||||
@HiveField(1)
|
||||
List<String>? functions;
|
||||
|
||||
@HiveField(2)
|
||||
Module? module;
|
||||
|
||||
TargetPage({required this.route, this.functions, this.module});
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'target_page.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class TargetPageAdapter extends TypeAdapter<TargetPage> {
|
||||
@override
|
||||
final typeId = 2;
|
||||
|
||||
@override
|
||||
TargetPage read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return TargetPage(
|
||||
route: fields[0] as String,
|
||||
functions: (fields[1] as List?)?.cast<String>(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, TargetPage obj) {
|
||||
writer
|
||||
..writeByte(2)
|
||||
..writeByte(0)
|
||||
..write(obj.route)
|
||||
..writeByte(1)
|
||||
..write(obj.functions);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is TargetPageAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
@@ -3,11 +3,13 @@
|
||||
// Check in to version control
|
||||
|
||||
import 'package:hive_ce/hive.dart';
|
||||
import 'package:rasadyar_core/data/model/local/target_page/target_page.dart';
|
||||
import 'package:rasadyar_core/data/model/local/user_local/user_local_model.dart';
|
||||
|
||||
extension HiveRegistrar on HiveInterface {
|
||||
void registerAdapters() {
|
||||
registerAdapter(ModuleAdapter());
|
||||
registerAdapter(TargetPageAdapter());
|
||||
registerAdapter(UserLocalModelAdapter());
|
||||
}
|
||||
}
|
||||
@@ -15,6 +17,7 @@ extension HiveRegistrar on HiveInterface {
|
||||
extension IsolatedHiveRegistrar on IsolatedHiveInterface {
|
||||
void registerAdapters() {
|
||||
registerAdapter(ModuleAdapter());
|
||||
registerAdapter(TargetPageAdapter());
|
||||
registerAdapter(UserLocalModelAdapter());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
//Auth
|
||||
const int authUserLocalModelTypeId = 0;
|
||||
const int authModuleTypeId = 1;
|
||||
const int targetPageTypeId = 2;
|
||||
|
||||
//chicken
|
||||
const int chickenWidelyUsedLocalModelTypeId = 2;
|
||||
const int chickenWidelyUsedLocalItemTypeId = 3;
|
||||
const int chickenWidelyUsedLocalModelTypeId = 3;
|
||||
const int chickenWidelyUsedLocalItemTypeId = 4;
|
||||
|
||||
//liveStock
|
||||
|
||||
const int liveStockDataLocalModelTypeId = 4;
|
||||
const int liveStockDataRancherLocalModelTypeId = 5;
|
||||
const int liveStockDataHerdLocalModelTypeId = 6;
|
||||
const int liveStockDataLocationLocalModelTypeId = 7;
|
||||
const int liveStockDataLivestockLocalModelTypeId = 8;
|
||||
const int liveStockDataLocalModelTypeId = 5;
|
||||
const int liveStockDataRancherLocalModelTypeId = 6;
|
||||
const int liveStockDataHerdLocalModelTypeId = 7;
|
||||
const int liveStockDataLocationLocalModelTypeId = 8;
|
||||
const int liveStockDataLivestockLocalModelTypeId = 9;
|
||||
Reference in New Issue
Block a user