Message.fromList constructor
Message.fromList(
- List data
Creates a Message instance from a list of objects received from the broadcast stream of the event channel.
data should be a list where:
- data
0: message body (String) - data
1: sender address (String) - data
2: timestamp in milliseconds since epoch (String or int)
Implementation
factory Message.fromList(List<dynamic> data) {
return Message(
body: data[0] as String,
sender: data[1] as String,
timeReceived: DateTime.fromMillisecondsSinceEpoch(
int.parse(data[2].toString()),
),
);
}