handle case where map['session'] is null gracefully
This commit is contained in:
parent
c912fda3c3
commit
70b4e7d5a0
|
@ -6,6 +6,9 @@ class Sessions {
|
|||
);
|
||||
|
||||
factory Sessions.fromMap(Map<String, dynamic> map) {
|
||||
if (map["sessions"] == null) {
|
||||
throw Exception('\'map["sessions"]\' must not be null');
|
||||
}
|
||||
return Sessions(
|
||||
List<Session>.from(map['sessions']?.map((x) => Session.fromMap(x))),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue