mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
refactor(core): destructure core folder and reintegrate extensions
This commit is contained in:
37
lib/database/models/external_module.dart
Normal file
37
lib/database/models/external_module.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:lunasea/core.dart';
|
||||
|
||||
part 'external_module.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
@HiveType(typeId: 26, adapterName: 'LunaExternalModuleAdapter')
|
||||
class LunaExternalModule extends HiveObject {
|
||||
@JsonKey()
|
||||
@HiveField(0)
|
||||
String displayName;
|
||||
|
||||
@JsonKey()
|
||||
@HiveField(1)
|
||||
String host;
|
||||
|
||||
LunaExternalModule({
|
||||
this.displayName = '',
|
||||
this.host = '',
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() => json.encode(this.toJson());
|
||||
|
||||
Map<String, dynamic> toJson() => _$LunaExternalModuleToJson(this);
|
||||
|
||||
factory LunaExternalModule.fromJson(Map<String, dynamic> json) {
|
||||
return _$LunaExternalModuleFromJson(json);
|
||||
}
|
||||
|
||||
factory LunaExternalModule.clone(LunaExternalModule profile) {
|
||||
return LunaExternalModule.fromJson(profile.toJson());
|
||||
}
|
||||
|
||||
factory LunaExternalModule.get(String key) {
|
||||
return LunaBox.externalModules.read(key)!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user