use Map<String, Object?> for extradata
This commit is contained in:
@@ -22,7 +22,7 @@ class Channel {
|
||||
this._client,
|
||||
this._type,
|
||||
this._id, {
|
||||
Map<String, Object> extraData = const {},
|
||||
Map<String, Object?> extraData = const {},
|
||||
}) : _cid = _id != null ? '$_type:$_id' : null,
|
||||
_extraData = extraData {
|
||||
_client.logger.info('New Channel instance not initialized created');
|
||||
@@ -630,7 +630,7 @@ class Channel {
|
||||
Future<SendReactionResponse> sendReaction(
|
||||
Message message,
|
||||
String type, {
|
||||
Map<String, Object> extraData = const {},
|
||||
Map<String, Object?> extraData = const {},
|
||||
bool enforceUnique = false,
|
||||
}) async {
|
||||
_checkInitialized();
|
||||
|
||||
@@ -1194,7 +1194,7 @@ class StreamChatClient {
|
||||
Channel channel(
|
||||
String type, {
|
||||
String? id,
|
||||
Map<String, Object> extraData = const {},
|
||||
Map<String, Object?> extraData = const {},
|
||||
}) {
|
||||
if (id != null && state.channels.containsKey('$type:$id')) {
|
||||
return state.channels['$type:$id']!;
|
||||
|
||||
@@ -114,7 +114,7 @@ class Attachment extends Equatable {
|
||||
includeIfNull: false,
|
||||
defaultValue: {},
|
||||
)
|
||||
final Map<String, Object> extraData;
|
||||
final Map<String, Object?> extraData;
|
||||
|
||||
/// The attachment ID.
|
||||
///
|
||||
@@ -183,7 +183,7 @@ class Attachment extends Equatable {
|
||||
List<Action>? actions,
|
||||
AttachmentFile? file,
|
||||
UploadState? uploadState,
|
||||
Map<String, Object>? extraData,
|
||||
Map<String, Object?>? extraData,
|
||||
}) =>
|
||||
Attachment(
|
||||
id: id ?? this.id,
|
||||
|
||||
@@ -30,10 +30,7 @@ Attachment _$AttachmentFromJson(Map<String, dynamic> json) {
|
||||
?.map((e) => Action.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
[],
|
||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as Object),
|
||||
) ??
|
||||
{},
|
||||
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||
file: json['file'] == null
|
||||
? null
|
||||
: AttachmentFile.fromJson(json['file'] as Map<String, dynamic>),
|
||||
|
||||
@@ -132,9 +132,8 @@ class _$PreparingCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
Preparing get _value => super._value as Preparing;
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$Preparing implements Preparing {
|
||||
const _$Preparing();
|
||||
|
||||
@@ -253,9 +252,8 @@ class _$InProgressCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
}
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$InProgress implements InProgress {
|
||||
const _$InProgress({required this.uploaded, required this.total});
|
||||
|
||||
@@ -382,9 +380,8 @@ class _$SuccessCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
Success get _value => super._value as Success;
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$Success implements Success {
|
||||
const _$Success();
|
||||
|
||||
@@ -497,9 +494,8 @@ class _$FailedCopyWithImpl<$Res> extends _$UploadStateCopyWithImpl<$Res>
|
||||
}
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$Failed implements Failed {
|
||||
const _$Failed({required this.error});
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ part of 'attachment_file.dart';
|
||||
|
||||
AttachmentFile _$AttachmentFileFromJson(Map<String, dynamic> json) {
|
||||
return AttachmentFile(
|
||||
size: json['size'] as int?,
|
||||
path: json['path'] as String?,
|
||||
name: json['name'] as String?,
|
||||
bytes: _fromString(json['bytes'] as String?),
|
||||
size: json['size'] as int?,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class ChannelModel {
|
||||
includeIfNull: false,
|
||||
defaultValue: {},
|
||||
)
|
||||
final Map<String, Object> extraData;
|
||||
final Map<String, Object?> extraData;
|
||||
|
||||
/// The team the channel belongs to
|
||||
@JsonKey(includeIfNull: false, toJson: Serialization.readOnly)
|
||||
@@ -132,7 +132,7 @@ class ChannelModel {
|
||||
DateTime? updatedAt,
|
||||
DateTime? deletedAt,
|
||||
int? memberCount,
|
||||
Map<String, Object>? extraData,
|
||||
Map<String, Object?>? extraData,
|
||||
String? team,
|
||||
}) =>
|
||||
ChannelModel(
|
||||
|
||||
@@ -31,10 +31,7 @@ ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) {
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
memberCount: json['member_count'] as int? ?? 0,
|
||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as Object),
|
||||
) ??
|
||||
{},
|
||||
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||
team: json['team'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class Event {
|
||||
|
||||
/// Map of custom channel extraData
|
||||
@JsonKey(defaultValue: {})
|
||||
final Map<String, Object> extraData;
|
||||
final Map<String, Object?> extraData;
|
||||
|
||||
/// Known top level fields.
|
||||
/// Useful for [Serialization] methods.
|
||||
@@ -140,7 +140,7 @@ class Event {
|
||||
int? unreadChannels,
|
||||
bool? online,
|
||||
String? parentId,
|
||||
Map<String, Object>? extraData,
|
||||
Map<String, Object?>? extraData,
|
||||
}) =>
|
||||
Event(
|
||||
type: type ?? this.type,
|
||||
@@ -180,7 +180,7 @@ class EventChannel extends ChannelModel {
|
||||
required DateTime updatedAt,
|
||||
DateTime? deletedAt,
|
||||
required int memberCount,
|
||||
Map<String, Object>? extraData,
|
||||
Map<String, Object?>? extraData,
|
||||
}) : super(
|
||||
id: id,
|
||||
type: type,
|
||||
|
||||
@@ -38,10 +38,7 @@ Event _$EventFromJson(Map<String, dynamic> json) {
|
||||
channelId: json['channel_id'] as String?,
|
||||
channelType: json['channel_type'] as String?,
|
||||
parentId: json['parent_id'] as String?,
|
||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as Object),
|
||||
) ??
|
||||
{},
|
||||
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||
isLocal: json['is_local'] as bool? ?? false,
|
||||
);
|
||||
}
|
||||
@@ -89,10 +86,7 @@ EventChannel _$EventChannelFromJson(Map<String, dynamic> json) {
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
memberCount: json['member_count'] as int? ?? 0,
|
||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as Object),
|
||||
) ??
|
||||
{},
|
||||
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ class Message extends Equatable {
|
||||
includeIfNull: false,
|
||||
defaultValue: {},
|
||||
)
|
||||
final Map<String, Object> extraData;
|
||||
final Map<String, Object?> extraData;
|
||||
|
||||
/// True if the message is a system info
|
||||
bool get isSystem => type == 'system';
|
||||
@@ -289,7 +289,7 @@ class Message extends Equatable {
|
||||
DateTime? pinnedAt,
|
||||
Object? pinExpires = _pinExpires,
|
||||
User? pinnedBy,
|
||||
Map<String, Object>? extraData,
|
||||
Map<String, Object?>? extraData,
|
||||
MessageSendingStatus? status,
|
||||
bool? skipPush,
|
||||
}) {
|
||||
|
||||
@@ -63,10 +63,7 @@ Message _$MessageFromJson(Map<String, dynamic> json) {
|
||||
pinnedBy: json['pinned_by'] == null
|
||||
? null
|
||||
: User.fromJson(json['pinned_by'] as Map<String, dynamic>),
|
||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as Object),
|
||||
) ??
|
||||
{},
|
||||
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||
deletedAt: json['deleted_at'] == null
|
||||
? null
|
||||
: DateTime.parse(json['deleted_at'] as String),
|
||||
|
||||
@@ -23,7 +23,7 @@ class OwnUser extends User {
|
||||
DateTime? updatedAt,
|
||||
DateTime? lastActive,
|
||||
bool online = false,
|
||||
Map<String, Object> extraData = const {},
|
||||
Map<String, Object?> extraData = const {},
|
||||
bool banned = false,
|
||||
}) : super(
|
||||
id: id,
|
||||
|
||||
@@ -34,9 +34,7 @@ OwnUser _$OwnUserFromJson(Map<String, dynamic> json) {
|
||||
? null
|
||||
: DateTime.parse(json['last_active'] as String),
|
||||
online: json['online'] as bool? ?? false,
|
||||
extraData: (json['extra_data'] as Map<String, dynamic>).map(
|
||||
(k, e) => MapEntry(k, e as Object),
|
||||
),
|
||||
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||
banned: json['banned'] as bool? ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class Reaction {
|
||||
|
||||
/// Reaction custom extraData
|
||||
@JsonKey(includeIfNull: false)
|
||||
final Map<String, Object>? extraData;
|
||||
final Map<String, Object?>? extraData;
|
||||
|
||||
/// Map of custom user extraData
|
||||
static const topLevelFields = [
|
||||
@@ -75,7 +75,7 @@ class Reaction {
|
||||
User? user,
|
||||
String? userId,
|
||||
int? score,
|
||||
Map<String, Object>? extraData,
|
||||
Map<String, Object?>? extraData,
|
||||
}) =>
|
||||
Reaction(
|
||||
messageId: messageId ?? this.messageId,
|
||||
|
||||
@@ -18,9 +18,7 @@ Reaction _$ReactionFromJson(Map<String, dynamic> json) {
|
||||
: User.fromJson(json['user'] as Map<String, dynamic>),
|
||||
userId: json['user_id'] as String?,
|
||||
score: json['score'] as int? ?? 0,
|
||||
extraData: (json['extra_data'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as Object),
|
||||
),
|
||||
extraData: json['extra_data'] as Map<String, dynamic>?,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,11 @@ class User {
|
||||
final bool banned;
|
||||
|
||||
/// Map of custom user extraData
|
||||
@JsonKey(includeIfNull: false)
|
||||
final Map<String, Object> extraData;
|
||||
@JsonKey(
|
||||
includeIfNull: false,
|
||||
defaultValue: {},
|
||||
)
|
||||
final Map<String, Object?> extraData;
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
@@ -107,7 +110,7 @@ class User {
|
||||
DateTime? updatedAt,
|
||||
DateTime? lastActive,
|
||||
bool? online,
|
||||
Map<String, Object>? extraData,
|
||||
Map<String, Object?>? extraData,
|
||||
bool? banned,
|
||||
List<String>? teams,
|
||||
}) =>
|
||||
|
||||
@@ -20,9 +20,7 @@ User _$UserFromJson(Map<String, dynamic> json) {
|
||||
? null
|
||||
: DateTime.parse(json['last_active'] as String),
|
||||
online: json['online'] as bool? ?? false,
|
||||
extraData: (json['extra_data'] as Map<String, dynamic>).map(
|
||||
(k, e) => MapEntry(k, e as Object),
|
||||
),
|
||||
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
|
||||
banned: json['banned'] as bool? ?? false,
|
||||
teams:
|
||||
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
|
||||
|
||||
Reference in New Issue
Block a user