♻️ Refactored attachment cache
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:surface/types/account.dart';
|
||||
import 'package:surface/types/attachment.dart';
|
||||
import 'package:surface/types/realm.dart';
|
||||
|
||||
part 'chat.freezed.dart';
|
||||
@ -79,8 +80,22 @@ class SnChatMessage with _$SnChatMessage {
|
||||
@HiveField(8) required SnChannelMember sender,
|
||||
@HiveField(9) required int channelId,
|
||||
@HiveField(10) required int senderId,
|
||||
SnChatMessagePreload? preload,
|
||||
}) = _SnChatMessage;
|
||||
|
||||
factory SnChatMessage.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnChatMessageFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class SnChatMessagePreload with _$SnChatMessagePreload {
|
||||
const SnChatMessagePreload._();
|
||||
|
||||
@HiveType(typeId: 5)
|
||||
const factory SnChatMessagePreload({
|
||||
@HiveField(0) List<SnAttachment?>? attachments,
|
||||
}) = _SnChatMessagePreload;
|
||||
|
||||
factory SnChatMessagePreload.fromJson(Map<String, dynamic> json) =>
|
||||
_$SnChatMessagePreloadFromJson(json);
|
||||
}
|
||||
|
@ -1083,6 +1083,7 @@ mixin _$SnChatMessage {
|
||||
int get channelId => throw _privateConstructorUsedError;
|
||||
@HiveField(10)
|
||||
int get senderId => throw _privateConstructorUsedError;
|
||||
SnChatMessagePreload? get preload => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this SnChatMessage to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@ -1111,10 +1112,12 @@ abstract class $SnChatMessageCopyWith<$Res> {
|
||||
@HiveField(7) SnChannel channel,
|
||||
@HiveField(8) SnChannelMember sender,
|
||||
@HiveField(9) int channelId,
|
||||
@HiveField(10) int senderId});
|
||||
@HiveField(10) int senderId,
|
||||
SnChatMessagePreload? preload});
|
||||
|
||||
$SnChannelCopyWith<$Res> get channel;
|
||||
$SnChannelMemberCopyWith<$Res> get sender;
|
||||
$SnChatMessagePreloadCopyWith<$Res>? get preload;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -1143,6 +1146,7 @@ class _$SnChatMessageCopyWithImpl<$Res, $Val extends SnChatMessage>
|
||||
Object? sender = null,
|
||||
Object? channelId = null,
|
||||
Object? senderId = null,
|
||||
Object? preload = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
@ -1189,6 +1193,10 @@ class _$SnChatMessageCopyWithImpl<$Res, $Val extends SnChatMessage>
|
||||
? _value.senderId
|
||||
: senderId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
preload: freezed == preload
|
||||
? _value.preload
|
||||
: preload // ignore: cast_nullable_to_non_nullable
|
||||
as SnChatMessagePreload?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@ -1211,6 +1219,20 @@ class _$SnChatMessageCopyWithImpl<$Res, $Val extends SnChatMessage>
|
||||
return _then(_value.copyWith(sender: value) as $Val);
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of SnChatMessage
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$SnChatMessagePreloadCopyWith<$Res>? get preload {
|
||||
if (_value.preload == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $SnChatMessagePreloadCopyWith<$Res>(_value.preload!, (value) {
|
||||
return _then(_value.copyWith(preload: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -1232,12 +1254,15 @@ abstract class _$$SnChatMessageImplCopyWith<$Res>
|
||||
@HiveField(7) SnChannel channel,
|
||||
@HiveField(8) SnChannelMember sender,
|
||||
@HiveField(9) int channelId,
|
||||
@HiveField(10) int senderId});
|
||||
@HiveField(10) int senderId,
|
||||
SnChatMessagePreload? preload});
|
||||
|
||||
@override
|
||||
$SnChannelCopyWith<$Res> get channel;
|
||||
@override
|
||||
$SnChannelMemberCopyWith<$Res> get sender;
|
||||
@override
|
||||
$SnChatMessagePreloadCopyWith<$Res>? get preload;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -1264,6 +1289,7 @@ class __$$SnChatMessageImplCopyWithImpl<$Res>
|
||||
Object? sender = null,
|
||||
Object? channelId = null,
|
||||
Object? senderId = null,
|
||||
Object? preload = freezed,
|
||||
}) {
|
||||
return _then(_$SnChatMessageImpl(
|
||||
id: null == id
|
||||
@ -1310,6 +1336,10 @@ class __$$SnChatMessageImplCopyWithImpl<$Res>
|
||||
? _value.senderId
|
||||
: senderId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
preload: freezed == preload
|
||||
? _value.preload
|
||||
: preload // ignore: cast_nullable_to_non_nullable
|
||||
as SnChatMessagePreload?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -1329,7 +1359,8 @@ class _$SnChatMessageImpl extends _SnChatMessage {
|
||||
@HiveField(7) required this.channel,
|
||||
@HiveField(8) required this.sender,
|
||||
@HiveField(9) required this.channelId,
|
||||
@HiveField(10) required this.senderId})
|
||||
@HiveField(10) required this.senderId,
|
||||
this.preload})
|
||||
: _body = body,
|
||||
super._();
|
||||
|
||||
@ -1375,10 +1406,12 @@ class _$SnChatMessageImpl extends _SnChatMessage {
|
||||
@override
|
||||
@HiveField(10)
|
||||
final int senderId;
|
||||
@override
|
||||
final SnChatMessagePreload? preload;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SnChatMessage(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, uuid: $uuid, body: $body, type: $type, channel: $channel, sender: $sender, channelId: $channelId, senderId: $senderId)';
|
||||
return 'SnChatMessage(id: $id, createdAt: $createdAt, updatedAt: $updatedAt, deletedAt: $deletedAt, uuid: $uuid, body: $body, type: $type, channel: $channel, sender: $sender, channelId: $channelId, senderId: $senderId, preload: $preload)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -1401,7 +1434,8 @@ class _$SnChatMessageImpl extends _SnChatMessage {
|
||||
(identical(other.channelId, channelId) ||
|
||||
other.channelId == channelId) &&
|
||||
(identical(other.senderId, senderId) ||
|
||||
other.senderId == senderId));
|
||||
other.senderId == senderId) &&
|
||||
(identical(other.preload, preload) || other.preload == preload));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@ -1418,7 +1452,8 @@ class _$SnChatMessageImpl extends _SnChatMessage {
|
||||
channel,
|
||||
sender,
|
||||
channelId,
|
||||
senderId);
|
||||
senderId,
|
||||
preload);
|
||||
|
||||
/// Create a copy of SnChatMessage
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -1448,7 +1483,8 @@ abstract class _SnChatMessage extends SnChatMessage {
|
||||
@HiveField(7) required final SnChannel channel,
|
||||
@HiveField(8) required final SnChannelMember sender,
|
||||
@HiveField(9) required final int channelId,
|
||||
@HiveField(10) required final int senderId}) = _$SnChatMessageImpl;
|
||||
@HiveField(10) required final int senderId,
|
||||
final SnChatMessagePreload? preload}) = _$SnChatMessageImpl;
|
||||
const _SnChatMessage._() : super._();
|
||||
|
||||
factory _SnChatMessage.fromJson(Map<String, dynamic> json) =
|
||||
@ -1487,6 +1523,8 @@ abstract class _SnChatMessage extends SnChatMessage {
|
||||
@override
|
||||
@HiveField(10)
|
||||
int get senderId;
|
||||
@override
|
||||
SnChatMessagePreload? get preload;
|
||||
|
||||
/// Create a copy of SnChatMessage
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@ -1495,3 +1533,174 @@ abstract class _SnChatMessage extends SnChatMessage {
|
||||
_$$SnChatMessageImplCopyWith<_$SnChatMessageImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
SnChatMessagePreload _$SnChatMessagePreloadFromJson(Map<String, dynamic> json) {
|
||||
return _SnChatMessagePreload.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SnChatMessagePreload {
|
||||
@HiveField(0)
|
||||
List<SnAttachment?>? get attachments => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this SnChatMessagePreload to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of SnChatMessagePreload
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$SnChatMessagePreloadCopyWith<SnChatMessagePreload> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $SnChatMessagePreloadCopyWith<$Res> {
|
||||
factory $SnChatMessagePreloadCopyWith(SnChatMessagePreload value,
|
||||
$Res Function(SnChatMessagePreload) then) =
|
||||
_$SnChatMessagePreloadCopyWithImpl<$Res, SnChatMessagePreload>;
|
||||
@useResult
|
||||
$Res call({@HiveField(0) List<SnAttachment?>? attachments});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$SnChatMessagePreloadCopyWithImpl<$Res,
|
||||
$Val extends SnChatMessagePreload>
|
||||
implements $SnChatMessagePreloadCopyWith<$Res> {
|
||||
_$SnChatMessagePreloadCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of SnChatMessagePreload
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? attachments = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
attachments: freezed == attachments
|
||||
? _value.attachments
|
||||
: attachments // ignore: cast_nullable_to_non_nullable
|
||||
as List<SnAttachment?>?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$SnChatMessagePreloadImplCopyWith<$Res>
|
||||
implements $SnChatMessagePreloadCopyWith<$Res> {
|
||||
factory _$$SnChatMessagePreloadImplCopyWith(_$SnChatMessagePreloadImpl value,
|
||||
$Res Function(_$SnChatMessagePreloadImpl) then) =
|
||||
__$$SnChatMessagePreloadImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({@HiveField(0) List<SnAttachment?>? attachments});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$SnChatMessagePreloadImplCopyWithImpl<$Res>
|
||||
extends _$SnChatMessagePreloadCopyWithImpl<$Res, _$SnChatMessagePreloadImpl>
|
||||
implements _$$SnChatMessagePreloadImplCopyWith<$Res> {
|
||||
__$$SnChatMessagePreloadImplCopyWithImpl(_$SnChatMessagePreloadImpl _value,
|
||||
$Res Function(_$SnChatMessagePreloadImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of SnChatMessagePreload
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? attachments = freezed,
|
||||
}) {
|
||||
return _then(_$SnChatMessagePreloadImpl(
|
||||
attachments: freezed == attachments
|
||||
? _value._attachments
|
||||
: attachments // ignore: cast_nullable_to_non_nullable
|
||||
as List<SnAttachment?>?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
@HiveType(typeId: 5)
|
||||
class _$SnChatMessagePreloadImpl extends _SnChatMessagePreload {
|
||||
const _$SnChatMessagePreloadImpl(
|
||||
{@HiveField(0) final List<SnAttachment?>? attachments})
|
||||
: _attachments = attachments,
|
||||
super._();
|
||||
|
||||
factory _$SnChatMessagePreloadImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$SnChatMessagePreloadImplFromJson(json);
|
||||
|
||||
final List<SnAttachment?>? _attachments;
|
||||
@override
|
||||
@HiveField(0)
|
||||
List<SnAttachment?>? get attachments {
|
||||
final value = _attachments;
|
||||
if (value == null) return null;
|
||||
if (_attachments is EqualUnmodifiableListView) return _attachments;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SnChatMessagePreload(attachments: $attachments)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SnChatMessagePreloadImpl &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._attachments, _attachments));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, const DeepCollectionEquality().hash(_attachments));
|
||||
|
||||
/// Create a copy of SnChatMessagePreload
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$SnChatMessagePreloadImplCopyWith<_$SnChatMessagePreloadImpl>
|
||||
get copyWith =>
|
||||
__$$SnChatMessagePreloadImplCopyWithImpl<_$SnChatMessagePreloadImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$SnChatMessagePreloadImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _SnChatMessagePreload extends SnChatMessagePreload {
|
||||
const factory _SnChatMessagePreload(
|
||||
{@HiveField(0) final List<SnAttachment?>? attachments}) =
|
||||
_$SnChatMessagePreloadImpl;
|
||||
const _SnChatMessagePreload._() : super._();
|
||||
|
||||
factory _SnChatMessagePreload.fromJson(Map<String, dynamic> json) =
|
||||
_$SnChatMessagePreloadImpl.fromJson;
|
||||
|
||||
@override
|
||||
@HiveField(0)
|
||||
List<SnAttachment?>? get attachments;
|
||||
|
||||
/// Create a copy of SnChatMessagePreload
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$SnChatMessagePreloadImplCopyWith<_$SnChatMessagePreloadImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
@ -204,6 +204,41 @@ class SnChatMessageImplAdapter extends TypeAdapter<_$SnChatMessageImpl> {
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class SnChatMessagePreloadImplAdapter
|
||||
extends TypeAdapter<_$SnChatMessagePreloadImpl> {
|
||||
@override
|
||||
final int typeId = 5;
|
||||
|
||||
@override
|
||||
_$SnChatMessagePreloadImpl read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return _$SnChatMessagePreloadImpl(
|
||||
attachments: (fields[0] as List?)?.cast<SnAttachment?>(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, _$SnChatMessagePreloadImpl obj) {
|
||||
writer
|
||||
..writeByte(1)
|
||||
..writeByte(0)
|
||||
..write(obj.attachments);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is SnChatMessagePreloadImplAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
@ -309,6 +344,10 @@ _$SnChatMessageImpl _$$SnChatMessageImplFromJson(Map<String, dynamic> json) =>
|
||||
sender: SnChannelMember.fromJson(json['sender'] as Map<String, dynamic>),
|
||||
channelId: (json['channel_id'] as num).toInt(),
|
||||
senderId: (json['sender_id'] as num).toInt(),
|
||||
preload: json['preload'] == null
|
||||
? null
|
||||
: SnChatMessagePreload.fromJson(
|
||||
json['preload'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SnChatMessageImplToJson(_$SnChatMessageImpl instance) =>
|
||||
@ -324,4 +363,21 @@ Map<String, dynamic> _$$SnChatMessageImplToJson(_$SnChatMessageImpl instance) =>
|
||||
'sender': instance.sender.toJson(),
|
||||
'channel_id': instance.channelId,
|
||||
'sender_id': instance.senderId,
|
||||
'preload': instance.preload?.toJson(),
|
||||
};
|
||||
|
||||
_$SnChatMessagePreloadImpl _$$SnChatMessagePreloadImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$SnChatMessagePreloadImpl(
|
||||
attachments: (json['attachments'] as List<dynamic>?)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: SnAttachment.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SnChatMessagePreloadImplToJson(
|
||||
_$SnChatMessagePreloadImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'attachments': instance.attachments?.map((e) => e?.toJson()).toList(),
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ class SnPost with _$SnPost {
|
||||
@freezed
|
||||
class SnPostPreload with _$SnPostPreload {
|
||||
const factory SnPostPreload({
|
||||
required List<SnAttachment>? attachments,
|
||||
required List<SnAttachment?>? attachments,
|
||||
}) = _SnPostPreload;
|
||||
|
||||
factory SnPostPreload.fromJson(Map<String, Object?> json) =>
|
||||
|
@ -953,7 +953,7 @@ SnPostPreload _$SnPostPreloadFromJson(Map<String, dynamic> json) {
|
||||
|
||||
/// @nodoc
|
||||
mixin _$SnPostPreload {
|
||||
List<SnAttachment>? get attachments => throw _privateConstructorUsedError;
|
||||
List<SnAttachment?>? get attachments => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this SnPostPreload to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@ -971,7 +971,7 @@ abstract class $SnPostPreloadCopyWith<$Res> {
|
||||
SnPostPreload value, $Res Function(SnPostPreload) then) =
|
||||
_$SnPostPreloadCopyWithImpl<$Res, SnPostPreload>;
|
||||
@useResult
|
||||
$Res call({List<SnAttachment>? attachments});
|
||||
$Res call({List<SnAttachment?>? attachments});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -995,7 +995,7 @@ class _$SnPostPreloadCopyWithImpl<$Res, $Val extends SnPostPreload>
|
||||
attachments: freezed == attachments
|
||||
? _value.attachments
|
||||
: attachments // ignore: cast_nullable_to_non_nullable
|
||||
as List<SnAttachment>?,
|
||||
as List<SnAttachment?>?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
@ -1008,7 +1008,7 @@ abstract class _$$SnPostPreloadImplCopyWith<$Res>
|
||||
__$$SnPostPreloadImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({List<SnAttachment>? attachments});
|
||||
$Res call({List<SnAttachment?>? attachments});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@ -1030,7 +1030,7 @@ class __$$SnPostPreloadImplCopyWithImpl<$Res>
|
||||
attachments: freezed == attachments
|
||||
? _value._attachments
|
||||
: attachments // ignore: cast_nullable_to_non_nullable
|
||||
as List<SnAttachment>?,
|
||||
as List<SnAttachment?>?,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -1038,15 +1038,15 @@ class __$$SnPostPreloadImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$SnPostPreloadImpl implements _SnPostPreload {
|
||||
const _$SnPostPreloadImpl({required final List<SnAttachment>? attachments})
|
||||
const _$SnPostPreloadImpl({required final List<SnAttachment?>? attachments})
|
||||
: _attachments = attachments;
|
||||
|
||||
factory _$SnPostPreloadImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$SnPostPreloadImplFromJson(json);
|
||||
|
||||
final List<SnAttachment>? _attachments;
|
||||
final List<SnAttachment?>? _attachments;
|
||||
@override
|
||||
List<SnAttachment>? get attachments {
|
||||
List<SnAttachment?>? get attachments {
|
||||
final value = _attachments;
|
||||
if (value == null) return null;
|
||||
if (_attachments is EqualUnmodifiableListView) return _attachments;
|
||||
@ -1091,13 +1091,13 @@ class _$SnPostPreloadImpl implements _SnPostPreload {
|
||||
|
||||
abstract class _SnPostPreload implements SnPostPreload {
|
||||
const factory _SnPostPreload(
|
||||
{required final List<SnAttachment>? attachments}) = _$SnPostPreloadImpl;
|
||||
{required final List<SnAttachment?>? attachments}) = _$SnPostPreloadImpl;
|
||||
|
||||
factory _SnPostPreload.fromJson(Map<String, dynamic> json) =
|
||||
_$SnPostPreloadImpl.fromJson;
|
||||
|
||||
@override
|
||||
List<SnAttachment>? get attachments;
|
||||
List<SnAttachment?>? get attachments;
|
||||
|
||||
/// Create a copy of SnPostPreload
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
@ -103,13 +103,15 @@ Map<String, dynamic> _$$SnPostImplToJson(_$SnPostImpl instance) =>
|
||||
_$SnPostPreloadImpl _$$SnPostPreloadImplFromJson(Map<String, dynamic> json) =>
|
||||
_$SnPostPreloadImpl(
|
||||
attachments: (json['attachments'] as List<dynamic>?)
|
||||
?.map((e) => SnAttachment.fromJson(e as Map<String, dynamic>))
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: SnAttachment.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SnPostPreloadImplToJson(_$SnPostPreloadImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'attachments': instance.attachments?.map((e) => e.toJson()).toList(),
|
||||
'attachments': instance.attachments?.map((e) => e?.toJson()).toList(),
|
||||
};
|
||||
|
||||
_$SnBodyImpl _$$SnBodyImplFromJson(Map<String, dynamic> json) => _$SnBodyImpl(
|
||||
|
Reference in New Issue
Block a user