@@ -16,18 +16,18 @@ class AppData {
16
16
'space_efc5b3ef96ea4bffbde733e249c8cbb3'
17
17
};
18
18
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;
31
31
32
32
static init () async {
33
33
const String DIRECTORY = 'assets/setup' ;
@@ -50,7 +50,7 @@ class AppData {
50
50
51
51
_directChats = directs.map ((space) => Space .fromJson (space)).toList ();
52
52
53
- _currentUser = _users[Random ().nextInt (_users.length - 4 )];
53
+ _currentUser = _users! [Random ().nextInt (_users! .length - 4 )];
54
54
55
55
_conversations = chatMessages
56
56
.map ((conversation) => ChatMessage .fromJson (conversation))
@@ -59,15 +59,15 @@ class AppData {
59
59
60
60
static UserProfile getUserById (String uuid) {
61
61
if (uuid == 'current_user' ) {
62
- return currentUser;
62
+ return currentUser! ;
63
63
}
64
- return users.firstWhere ((user) => (user.uuid == uuid));
64
+ return users! .firstWhere ((user) => (user.uuid == uuid));
65
65
}
66
66
67
- static Space getSpaceById (String id) {
67
+ static Space getSpaceById (String ? id) {
68
68
if (id == null ) {
69
- return defaultSpace;
69
+ return defaultSpace! ;
70
70
}
71
- return allSpaces.firstWhere ((space) => space.id == id);
71
+ return allSpaces! .firstWhere ((space) => space.id == id);
72
72
}
73
73
}
0 commit comments