Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.84 KB | None | 0 0
  1.   factory Absence.fromJson(Map<dynamic, dynamic> json,
  2.       [Register registerType = Register.Argo]) {
  3.     if (registerType == Register.Argo) {
  4.       return Absence(
  5.         joinedLessonAt: json["numOra"],
  6.         code: json["codEvento"],
  7.         date: DateTime.parse(json["datAssenza"]),
  8.         justified: json["flgDaGiustificare"],
  9.         datJustified: json["datGiustificazione"],
  10.         binUid: json["binUid"],
  11.       );
  12.     } else {
  13.       final cvvCode = json["evtCode"];
  14.       final String code =
  15.           cvvCode == 'ABA0' ? 'A' : cvvCode == 'ABU0' ? 'U' : 'R';
  16.       return Absence(
  17.         joinedLessonAt: json["evtHPos"], //Posizione ora
  18.         code: code,
  19.         date: DateTime.parse(json["evtDate"]),
  20.         justified: json["isJustified"],
  21.         datJustified: null,
  22.         binUid: json["evtId"],
  23.       );
  24.     }
  25.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement