ObjectBox

This commit is contained in:
Sven committed 2025-10-23 11:28:03 +02:00
1 parent e548f62bde
commit f8317be627
60 files changed
+2367 -15049

No files matched your search

+8 -12
View File
@@ -1,7 +1,4 @@
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'log_entry.g.dart';
import 'package:objectbox/objectbox.dart';
enum LogEntrySeverityEnum {
info,
@@ -9,21 +6,20 @@ enum LogEntrySeverityEnum {
error
}
@collection
@JsonSerializable()
@Entity()
class LogEntry {
late Id id = Isar.autoIncrement;
@Id()
int id = 0;
@Property(type: PropertyType.date)
late DateTime time;
@enumerated
late LogEntrySeverityEnum severity;
late int severity; // Store enum as int
late String text;
LogEntry();
factory LogEntry.fromJson(Map<String, dynamic> json) => _$LogEntryFromJson(json);
Map<String, dynamic> toJson() => _$LogEntryToJson(this);
LogEntrySeverityEnum get severityEnum => LogEntrySeverityEnum.values[severity];
set severityEnum(LogEntrySeverityEnum value) => severity = value.index;
}