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 rows = await _client.from(path).select().order("timestamp");
  return rows.map((row) {
    final data = Map<String, dynamic>.from(row);
    final id = data.remove("id").toString();
    return ChatBackendMessage(id: id, data: _normalize(data));
  }).toList();
}