🐛 Realm related bug fixes

This commit is contained in:
2025-02-16 19:50:34 +08:00
parent a7829d15b2
commit 365f330629
6 changed files with 67 additions and 61 deletions

View File

@@ -20,7 +20,7 @@ class SnAccount with _$SnAccount {
required String description,
required String name,
required String nick,
required Map<String, dynamic> permNodes,
@Default({}) Map<String, dynamic> permNodes,
required String language,
required SnAccountProfile? profile,
@Default([]) List<SnAccountBadge> badges,

View File

@@ -385,7 +385,7 @@ class _$SnAccountImpl extends _SnAccount {
required this.description,
required this.name,
required this.nick,
required final Map<String, dynamic> permNodes,
final Map<String, dynamic> permNodes = const {},
required this.language,
required this.profile,
final List<SnAccountBadge> badges = const [],
@@ -437,6 +437,7 @@ class _$SnAccountImpl extends _SnAccount {
final String nick;
final Map<String, dynamic> _permNodes;
@override
@JsonKey()
Map<String, dynamic> get permNodes {
if (_permNodes is EqualUnmodifiableMapView) return _permNodes;
// ignore: implicit_dynamic_type
@@ -566,7 +567,7 @@ abstract class _SnAccount extends SnAccount {
required final String description,
required final String name,
required final String nick,
required final Map<String, dynamic> permNodes,
final Map<String, dynamic> permNodes,
required final String language,
required final SnAccountProfile? profile,
final List<SnAccountBadge> badges,

View File

@@ -25,7 +25,7 @@ _$SnAccountImpl _$$SnAccountImplFromJson(Map<String, dynamic> json) =>
description: json['description'] as String,
name: json['name'] as String,
nick: json['nick'] as String,
permNodes: json['perm_nodes'] as Map<String, dynamic>,
permNodes: json['perm_nodes'] as Map<String, dynamic>? ?? const {},
language: json['language'] as String,
profile: json['profile'] == null
? null