handle case where map['session'] is null gracefully

This commit is contained in:
ashilkn 2022-09-19 15:31:05 +05:30
parent c912fda3c3
commit 70b4e7d5a0

View file

@ -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))),
);