Skip to content

Commit

Permalink
Fix Json convert error
Browse files Browse the repository at this point in the history
  • Loading branch information
tungpx committed Aug 30, 2021
1 parent 3db888f commit 275a037
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions lib/src/models/credential.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,14 @@ class Credential {
done: msg['done'],
);
}

Map<String, dynamic> toJson() {
return {
'meth': meth,
'val': val,
'resp': resp,
'done': done,
'params': params,
};
}
}
8 changes: 8 additions & 0 deletions lib/src/models/del-range.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ class DelRange {
this.hi,
this.all,
});

Map<String, dynamic> toJson() {
return {
'low': low,
'hi': hi,
'all': all
};
}
}
2 changes: 1 addition & 1 deletion lib/src/models/packet-data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class AccPacketData extends PacketData {
class LoginPacketData extends PacketData {
String? scheme;
String? secret;
Map<String, dynamic>? cred;
List<Map<String, dynamic>>? cred;

LoginPacketData({this.scheme, this.secret, this.cred});

Expand Down
2 changes: 1 addition & 1 deletion lib/src/services/tinode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class TinodeService {
var data = packet.data as LoginPacketData;
data.scheme = scheme;
data.secret = secret;
data.cred = cred;
data.cred = [if (cred != null) cred];

packet.data = data;

Expand Down

0 comments on commit 275a037

Please sign in to comment.