// ignore_for_file: sort_constructors_first import 'package:flutter/foundation.dart'; /// Timeline event stored for a specific relationship. @immutable class RelationshipMoment { const RelationshipMoment({ required this.id, required this.personId, required this.title, required this.summary, required this.at, required this.type, }); final String id; final String personId; final String title; final String summary; final DateTime at; final String type; RelationshipMoment copyWith({ String? id, String? personId, String? title, String? summary, DateTime? at, String? type, }) { return RelationshipMoment( id: id ?? this.id, personId: personId ?? this.personId, title: title ?? this.title, summary: summary ?? this.summary, at: at ?? this.at, type: type ?? this.type, ); } Map toJson() { return { 'id': id, 'personId': personId, 'title': title, 'summary': summary, 'at': at.toUtc().toIso8601String(), 'type': type, }; } factory RelationshipMoment.fromJson(Map json) { return RelationshipMoment( id: json['id'] as String, personId: json['personId'] as String, title: json['title'] as String, summary: json['summary'] as String, at: DateTime.parse(json['at'] as String).toLocal(), type: json['type'] as String, ); } }