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