@@ -16,18 +16,18 @@ class AppData {
1616 'space_efc5b3ef96ea4bffbde733e249c8cbb3'
1717 };
1818 static const INDICATORTIMEOUT = 10 ;
19- static List <UserProfile > _users;
20- static UserProfile _currentUser;
21- static List <Space > _spaces;
22- static List <Space > _directChats;
23- static List <ChatMessage > _conversations;
24- static UserProfile get currentUser => _currentUser;
25- static Space get defaultSpace => _spaces.first;
26- static List <Space > get spaces => _spaces;
27- static List <Space > get directChats => _directChats;
28- static List <Space > get allSpaces => [..._spaces, ..._directChats];
29- static List <UserProfile > get users => [..._users];
30- static List <ChatMessage > get conversations => _conversations;
19+ static List <UserProfile >? _users;
20+ static UserProfile ? _currentUser;
21+ static List <Space >? _spaces;
22+ static List <Space >? _directChats;
23+ static List <ChatMessage >? _conversations;
24+ static UserProfile ? get currentUser => _currentUser;
25+ static Space ? get defaultSpace => _spaces! .first;
26+ static List <Space >? get spaces => _spaces;
27+ static List <Space >? get directChats => _directChats;
28+ static List <Space >? get allSpaces => [..._spaces! , ..._directChats! ];
29+ static List <UserProfile >? get users => [..._users! ];
30+ static List <ChatMessage >? get conversations => _conversations;
3131
3232 static init () async {
3333 const String DIRECTORY = 'assets/setup' ;
@@ -50,7 +50,7 @@ class AppData {
5050
5151 _directChats = directs.map ((space) => Space .fromJson (space)).toList ();
5252
53- _currentUser = _users[Random ().nextInt (_users.length - 4 )];
53+ _currentUser = _users! [Random ().nextInt (_users! .length - 4 )];
5454
5555 _conversations = chatMessages
5656 .map ((conversation) => ChatMessage .fromJson (conversation))
@@ -59,15 +59,15 @@ class AppData {
5959
6060 static UserProfile getUserById (String uuid) {
6161 if (uuid == 'current_user' ) {
62- return currentUser;
62+ return currentUser! ;
6363 }
64- return users.firstWhere ((user) => (user.uuid == uuid));
64+ return users! .firstWhere ((user) => (user.uuid == uuid));
6565 }
6666
67- static Space getSpaceById (String id) {
67+ static Space getSpaceById (String ? id) {
6868 if (id == null ) {
69- return defaultSpace;
69+ return defaultSpace! ;
7070 }
71- return allSpaces.firstWhere ((space) => space.id == id);
71+ return allSpaces! .firstWhere ((space) => space.id == id);
7272 }
7373}
0 commit comments