refactor: Change name of archive getter to function

This is more intuitive because it is
a function that loads something from
the server and doesnt directly return
something.
This commit is contained in:
Christian Pauly 2021-08-25 10:36:58 +02:00
parent cec08b3775
commit 2f35277e47
2 changed files with 6 additions and 3 deletions

View File

@ -276,7 +276,7 @@ class Client extends MatrixApi {
}
/// Searches in the local cache for the given room and returns null if not
/// found. If you have loaded the [archive] before, it can also return
/// found. If you have loaded the [loadArchive()] before, it can also return
/// archived rooms.
Room getRoomById(String id) {
for (final room in <Room>[...rooms, ..._archivedRooms]) {
@ -651,7 +651,10 @@ class Client extends MatrixApi {
final List<Room> _archivedRooms = [];
Future<List<Room>> get archive async {
@Deprecated('Use [loadArchive()] instead.')
Future<List<Room>> get archive => loadArchive();
Future<List<Room>> loadArchive() async {
_archivedRooms.clear();
final syncResp = await sync(
filter: '{"room":{"include_leave":true,"timeline":{"limit":10}}}',

View File

@ -351,7 +351,7 @@ void main() {
});
test('get archive', () async {
final archive = await matrix.archive;
final archive = await matrix.loadArchive();
await Future.delayed(Duration(milliseconds: 50));
expect(archive.length, 2);