loadChannelMessages method

  1. @override
Future<List<Broadcast>> loadChannelMessages(
  1. String channel
)

Loads all locally cached Broadcast messages for a specific channel.

The returned list must be sorted in ascending order by its sequence_id so the local state engine can accurately replay the events to reconstruct the current state.

Implementation

@override
Future<List<Broadcast>> loadChannelMessages(String channel) async {
  final maps = await _db.query(
    Broadcast.tableName,
    where: '${Broadcast.columnChannel} = ?',
    whereArgs: [channel],
    orderBy:
    '${Broadcast.columnServertime} ASC, ${Broadcast.columnClientTimestamp} ASC',
  );
  return maps.map(Broadcast.fromMap).toList();
}