36 lines
732 B
Dart
36 lines
732 B
Dart
import 'package:isar/isar.dart';
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:stadtbote/tools/util.dart';
|
|
|
|
part 'message.g.dart';
|
|
|
|
@collection
|
|
@JsonSerializable()
|
|
class Message {
|
|
late Id id;
|
|
|
|
late String time;
|
|
|
|
late String from;
|
|
|
|
late String subj;
|
|
|
|
late List<String> text;
|
|
|
|
Message();
|
|
|
|
factory Message.fromJson(Map<String, dynamic> json) => _$MessageFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$MessageToJson(this);
|
|
|
|
static Future<int> getNextId() async {
|
|
int currentExport500Id = await Util.preferencesGetInt('next_message_id', 0) as int;
|
|
|
|
currentExport500Id += 1;
|
|
|
|
Util.preferencesSaveInt("next_message_id", currentExport500Id);
|
|
|
|
return currentExport500Id;
|
|
}
|
|
}
|