fetchMessages method

  1. @override
Future<List<ChatBackendMessage>> fetchMessages(
  1. String path
)
override

Fetches all existing messages for the conversation at path, ordered oldest first.

Implementation

@override
Future<List<ChatBackendMessage>> fetchMessages(String path) async {
  final result = await _tablesDB.listRows(
    databaseId: databaseId,
    tableId: path,
    queries: [Query.orderAsc("timestamp"), Query.limit(200)],
  );
  return result.rows.map((row) {
    return ChatBackendMessage(id: row.$id, data: _normalize(row.data));
  }).toList();
}