use common analysis options

This commit is contained in:
Salvatore Giordano
2021-05-06 11:48:26 +02:00
parent ba1ab4aed8
commit 18ce268e48
11 changed files with 16 additions and 446 deletions
@@ -646,7 +646,7 @@ class Channel {
messageId: messageId,
createdAt: now,
type: type,
user: user!,
user: user,
score: 1,
extraData: extraData,
);
@@ -654,7 +654,7 @@ class Channel {
// Inserting at the 0th index as it's the latest reaction
latestReactions.insert(0, newReaction);
final ownReactions = [...latestReactions]
..removeWhere((it) => it.userId != user.id);
..removeWhere((it) => it.userId != user!.id);
final newMessage = message.copyWith(
reactionCounts: {...message.reactionCounts ?? <String, int>{}}
+1 -2
View File
@@ -1495,8 +1495,7 @@ class ClientState {
Stream<OwnUser?> get userStream => _userController.stream;
/// The current user
Map<String?, User?> get users =>
_usersController.value as Map<String?, User?>;
Map<String?, User?> get users => _usersController.value!;
/// The current user as a stream
Stream<Map<String?, User?>> get usersStream => _usersController.stream;
@@ -78,10 +78,15 @@ abstract class ChatPersistenceClient {
getPinnedMessagesByCid(cid, messagePagination: pinnedMessagePagination),
]);
return ChannelState(
// ignore: cast_nullable_to_non_nullable
members: data[0] as List<Member>,
// ignore: cast_nullable_to_non_nullable
read: data[1] as List<Read>,
// ignore: cast_nullable_to_non_nullable
channel: data[2] as ChannelModel?,
// ignore: cast_nullable_to_non_nullable
messages: data[3] as List<Message>,
// ignore: cast_nullable_to_non_nullable
pinnedMessages: data[4] as List<Message>,
);
}
@@ -112,7 +112,7 @@ class ChannelModel {
/// Shortcut for channel name
String get name =>
extraData.containsKey('name') ? extraData['name'] as String : cid;
extraData.containsKey('name') ? extraData['name']! as String : cid;
/// Serialize to json
Map<String, dynamic> toJson() => Serialization.moveFromExtraDataToRoot(
@@ -83,7 +83,7 @@ class User {
/// Shortcut for user name
String get name {
if (extraData.containsKey('name')) {
final name = extraData['name'] as String;
final name = extraData['name']! as String;
if (name.isNotEmpty) return name;
}
return id;