Skip to content

Commit

Permalink
fix: null-safety error #96
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Sep 6, 2021
1 parent e32af63 commit 62ab0f4
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions lib/src/utils.dart
@@ -1,11 +1,12 @@
class AgoraRtmMessage {
String? text;
int? ts;
bool? offline;
String text;
int ts;
bool offline;

AgoraRtmMessage(this.text, this.ts, this.offline);

AgoraRtmMessage.fromText(String text) : text = text;
AgoraRtmMessage.fromText(String text, {this.ts = 0, this.offline = false})
: text = text;

AgoraRtmMessage.fromJson(Map<dynamic, dynamic> json)
: text = json['text'],
Expand Down Expand Up @@ -44,10 +45,11 @@ class AgoraRtmMember {
class AgoraRtmChannelAttribute {
String key;
String value;
String? userId;
int? updateTs;
String userId;
int updateTs;

AgoraRtmChannelAttribute(this.key, this.value, {this.userId, this.updateTs});
AgoraRtmChannelAttribute(this.key, this.value,
{this.userId = "", this.updateTs = 0});

AgoraRtmChannelAttribute.fromJson(Map<dynamic, dynamic> json)
: key = json['key'],
Expand All @@ -70,13 +72,13 @@ class AgoraRtmChannelAttribute {

class AgoraRtmLocalInvitation {
String calleeId;
String content;
String response;
String channelId;
String? content;
String? response;
String? channelId;
int state;

AgoraRtmLocalInvitation(
this.calleeId, this.content, this.response, this.channelId, this.state);
AgoraRtmLocalInvitation(this.calleeId,
{this.content, this.response, this.channelId, this.state = 0});

AgoraRtmLocalInvitation.fromJson(Map<dynamic, dynamic> json)
: calleeId = json['calleeId'],
Expand All @@ -101,13 +103,13 @@ class AgoraRtmLocalInvitation {

class AgoraRtmRemoteInvitation {
String callerId;
String content;
String response;
String channelId;
String? content;
String? response;
String? channelId;
int state;

AgoraRtmRemoteInvitation(
this.callerId, this.content, this.response, this.channelId, this.state);
AgoraRtmRemoteInvitation(this.callerId,
{this.content, this.response, this.channelId, this.state = 0});

AgoraRtmRemoteInvitation.fromJson(Map<dynamic, dynamic> json)
: callerId = json['callerId'],
Expand Down

0 comments on commit 62ab0f4

Please sign in to comment.