🐛 Fix local db old data cause crash
This commit is contained in:
@ -72,6 +72,7 @@ class _AttachmentListState extends State<AttachmentList> {
|
||||
double? consistentValue;
|
||||
int portrait = 0, square = 0, landscape = 0;
|
||||
for (var entry in _attachmentsMeta) {
|
||||
if (entry == null) continue;
|
||||
if (entry!.metadata?['ratio'] != null) {
|
||||
if (entry.metadata?['ratio'] is int) {
|
||||
consistentValue ??= entry.metadata?['ratio'].toDouble();
|
||||
|
@ -39,7 +39,7 @@ class ChatEvent extends StatelessWidget {
|
||||
|
||||
Widget _buildAttachment(BuildContext context, {bool isMinimal = false}) {
|
||||
final attachments = item.body['attachments'] != null
|
||||
? List<String>.from(item.body['attachments'].map((x) => x))
|
||||
? List<String>.from(item.body['attachments']?.whereType<String>())
|
||||
: List<String>.empty();
|
||||
|
||||
if (attachments.isEmpty) return const SizedBox();
|
||||
|
@ -293,7 +293,7 @@ class _PostItemState extends State<PostItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<String> attachments = item.body['attachments'] is List
|
||||
? item.body['attachments']?.cast<String>()
|
||||
? List.from(item.body['attachments']?.whereType<String>())
|
||||
: List.empty();
|
||||
final hasAttachment = attachments.isNotEmpty;
|
||||
|
||||
|
Reference in New Issue
Block a user