Created
November 23, 2023 12:26
-
-
Save RobertApikyan/16d5913df214830448e1ab58c40e6cda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventReport { | |
factory EventReport.fromMap(Map<String, dynamic> map) => EventReport( | |
legitimationStepType: map['legitimationStepType'] as String, | |
eventId: map['eventId'] as String, | |
timeStampInMillis: map['timeStampInMillis'] as int, | |
info: null, | |
); | |
EventReport( | |
{required this.legitimationStepType, | |
required this.eventId, | |
required this.timeStampInMillis, | |
this.info}); | |
final String legitimationStepType; | |
final String eventId; | |
final int timeStampInMillis; | |
final Map<String, dynamic>? info; | |
Map<String, dynamic> toMap() => { | |
'legitimationStepType': this.legitimationStepType, | |
'eventId': this.eventId, | |
'timeStampInMillis': this.timeStampInMillis, | |
'info': '${[ | |
for (final entity in info?.entries ?? {}.entries) | |
'\n${entity.key} : ${entity.value}' | |
].join(',')}', | |
}; | |
@override | |
String toString() => 'legitimationStepType: $legitimationStepType,\n' | |
'eventId: $eventId,\n' | |
'timeStampInMillis: ${DateTime.fromMillisecondsSinceEpoch(timeStampInMillis)},\n' | |
'info: $info'; | |
Map<String, dynamic> toJsonMap() => { | |
'legitimationStepType': this.legitimationStepType, | |
'eventId': this.eventId, | |
'timeStampInMillis': this.timeStampInMillis, | |
'info': this.info, | |
}; | |
factory EventReport.fromJsonMap(dynamic map) => EventReport( | |
legitimationStepType: map['legitimationStepType'] as String, | |
eventId: map['eventId'] as String, | |
timeStampInMillis: map['timeStampInMillis'] as int, | |
info: map['info'] != null ? map['info'] as Map<String, dynamic> : null, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment