sessions.dart 852 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. class Sessions {
  2. final List<Session> sessions;
  3. Sessions(
  4. this.sessions,
  5. );
  6. factory Sessions.fromMap(Map<String, dynamic> map) {
  7. if (map["sessions"] == null) {
  8. throw Exception('\'map["sessions"]\' must not be null');
  9. }
  10. return Sessions(
  11. List<Session>.from(map['sessions']?.map((x) => Session.fromMap(x))),
  12. );
  13. }
  14. }
  15. class Session {
  16. final String token;
  17. final int creationTime;
  18. final String ip;
  19. final String ua;
  20. final String prettyUA;
  21. final int lastUsedTime;
  22. Session(
  23. this.token,
  24. this.creationTime,
  25. this.ip,
  26. this.ua,
  27. this.prettyUA,
  28. this.lastUsedTime,
  29. );
  30. factory Session.fromMap(Map<String, dynamic> map) {
  31. return Session(
  32. map['token'],
  33. map['creationTime'],
  34. map['ip'],
  35. map['ua'],
  36. map['prettyUA'],
  37. map['lastUsedTime'],
  38. );
  39. }
  40. }