TF-831: add set forward to module
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import 'package:forward/forward/forward_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
class ForwardIdNullableConverter implements JsonConverter<ForwardId?, String?> {
|
||||
const ForwardIdNullableConverter();
|
||||
|
||||
@override
|
||||
ForwardId? fromJson(String? json) => json != null ? ForwardId(id: Id(json)) : null;
|
||||
|
||||
@override
|
||||
String? toJson(ForwardId? object) => object?.id.value;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:forward/forward/converter/forward_id_coverter.dart';
|
||||
import 'package:forward/forward/converter/forward_id_nullable_converter.dart';
|
||||
import 'package:forward/forward/forward.dart';
|
||||
import 'package:forward/forward/forward_id.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
@@ -6,13 +7,14 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
part 'tmail_forward.g.dart';
|
||||
|
||||
@ForwardIdConverter()
|
||||
@JsonSerializable()
|
||||
@ForwardIdNullableConverter()
|
||||
@JsonSerializable(explicitToJson: true, includeIfNull: false)
|
||||
class TMailForward extends Forward {
|
||||
final ForwardId id;
|
||||
final ForwardId? id;
|
||||
final bool localCopy;
|
||||
final Set<String> forwards;
|
||||
TMailForward({
|
||||
required this.id,
|
||||
this.id,
|
||||
required this.localCopy,
|
||||
required this.forwards,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user