@override Object toJson() => { 'parent': parent, if (memory case final memory?) 'memory': memory.toJson(), if (memoryId.isNotDefault) 'memoryId': memoryId, };