diff --git a/analysis_options.yaml b/analysis_options.yaml index 24559023..2de344a5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -10,6 +10,10 @@ linter: avoid_dynamic_calls: true analyzer: + language: + strict-casts: false + strict-inference: true + strict-raw-types: false errors: todo: ignore exclude: diff --git a/lib/fake_matrix_api.dart b/lib/fake_matrix_api.dart index bc4e5fe2..152eb8c4 100644 --- a/lib/fake_matrix_api.dart +++ b/lib/fake_matrix_api.dart @@ -64,14 +64,14 @@ class FakeMatrixApi extends MockClient { final method = request.method; final dynamic data = method == 'GET' ? request.url.queryParameters : request.body; - dynamic res = {}; + dynamic res = {}; var statusCode = 200; //print('\$method request to $action with Data: $data'); // Sync requests with timeout if (data is Map && data['timeout'] is String) { - await Future.delayed(Duration(seconds: 5)); + await Future.delayed(Duration(seconds: 5)); } if (request.url.origin != 'https://fakeserver.notexisting') { @@ -91,7 +91,7 @@ class FakeMatrixApi extends MockClient { } } else if (method == 'PUT' && action.contains('/client/v3/sendToDevice/')) { - res = {}; + res = {}; } else if (method == 'GET' && action.contains('/client/v3/rooms/') && action.contains('/state/m.room.member/')) { @@ -171,7 +171,7 @@ class FakeMatrixApi extends MockClient { 'unsigned': {'age': 1234} } ], - 'state': [], + 'state': [], }; static Map syncResponse = { @@ -393,7 +393,7 @@ class FakeMatrixApi extends MockClient { 'override': [ { 'actions': ['dont_notify'], - 'conditions': [], + 'conditions': [], 'default': true, 'enabled': false, 'rule_id': '.m.rule.master' @@ -427,7 +427,7 @@ class FakeMatrixApi extends MockClient { 'rule_id': '!localpart:server.abc' } ], - 'sender': [], + 'sender': [], 'underride': [ { 'actions': [ @@ -677,12 +677,12 @@ class FakeMatrixApi extends MockClient { static Map archiveSyncResponse = { 'next_batch': Random().nextDouble().toString(), - 'presence': {'events': []}, - 'account_data': {'events': []}, - 'to_device': {'events': []}, + 'presence': {'events': []}, + 'account_data': {'events': []}, + 'to_device': {'events': []}, 'rooms': { - 'join': {}, - 'invite': {}, + 'join': {}, + 'invite': {}, 'leave': { '!5345234234:example.com': { 'timeline': { @@ -727,7 +727,7 @@ class FakeMatrixApi extends MockClient { }, }, '!5345234235:example.com': { - 'timeline': {'events': []}, + 'timeline': {'events': []}, 'state': { 'events': [ { @@ -863,7 +863,7 @@ class FakeMatrixApi extends MockClient { 'join_rule': 'public', 'world_readable': true, 'guest_can_join': true, - 'children_state': [] + 'children_state': [] }, { 'room_id': '!aZUzMIEZvEwnDquxLf:neko.dev', @@ -876,7 +876,7 @@ class FakeMatrixApi extends MockClient { 'join_rule': 'public', 'world_readable': true, 'guest_can_join': true, - 'children_state': [] + 'children_state': [] }, { 'room_id': '!aRzRZBvOAkHMcEjAPS:libera.chat', @@ -888,7 +888,7 @@ class FakeMatrixApi extends MockClient { 'join_rule': 'public', 'world_readable': false, 'guest_can_join': false, - 'children_state': [] + 'children_state': [] }, { 'room_id': '!DXsRRxkqqDhDkAyXfL:matrix.org', @@ -901,7 +901,7 @@ class FakeMatrixApi extends MockClient { 'join_rule': 'public', 'world_readable': false, 'guest_can_join': false, - 'children_state': [] + 'children_state': [] }, { 'room_id': '!tbCRpmsMiwMBlIThOd:matrix.org', @@ -913,7 +913,7 @@ class FakeMatrixApi extends MockClient { 'join_rule': 'public', 'world_readable': false, 'guest_can_join': false, - 'children_state': [] + 'children_state': [] }, { 'room_id': '!LPpmvMsEgDwuSuHSpM:matrix.org', @@ -925,7 +925,7 @@ class FakeMatrixApi extends MockClient { 'join_rule': 'public', 'world_readable': true, 'guest_can_join': true, - 'children_state': [] + 'children_state': [] }, { 'room_id': '!prlZxmnmAGuCYHUNSw:neko.dev', @@ -938,7 +938,7 @@ class FakeMatrixApi extends MockClient { 'join_rule': 'public', 'world_readable': true, 'guest_can_join': false, - 'children_state': [] + 'children_state': [] }, { 'room_id': '!ooHixUOgoLVUjCSMZC:matrix.org', @@ -950,7 +950,7 @@ class FakeMatrixApi extends MockClient { 'join_rule': 'public', 'world_readable': true, 'guest_can_join': true, - 'children_state': [] + 'children_state': [] } ] }; @@ -982,7 +982,7 @@ class FakeMatrixApi extends MockClient { 'tags': { 'm.favourite': {'order': 0.1}, 'u.Work': {'order': 0.7}, - 'u.Customers': {} + 'u.Customers': {}, } }, '/client/v3/events?from=1234&timeout=10&room_id=%211234': (var req) => { @@ -1092,7 +1092,7 @@ class FakeMatrixApi extends MockClient { 'network_id': 'gitter', 'desc': 'Gitter', 'icon': 'mxc://example.org/zXyWvUt', - 'fields': {} + 'fields': {} } ] } @@ -1610,7 +1610,7 @@ class FakeMatrixApi extends MockClient { 'override': [ { 'actions': ['dont_notify'], - 'conditions': [], + 'conditions': [], 'default': true, 'enabled': false, 'rule_id': '.m.rule.master' @@ -1629,8 +1629,8 @@ class FakeMatrixApi extends MockClient { 'rule_id': '.m.rule.suppress_notices' } ], - 'room': [], - 'sender': [], + 'room': [], + 'sender': [], 'underride': [ { 'actions': [ @@ -1780,7 +1780,7 @@ class FakeMatrixApi extends MockClient { 'algorithm': AlgorithmTypes.megolmBackupV1Curve25519AesSha2, 'auth_data': { 'public_key': 'GXYaxqhNhUK28zUdxOmEsFRguz+PzBsDlTLlF0O0RkM', - 'signatures': {}, + 'signatures': {}, }, 'count': 0, 'etag': '0', @@ -1839,15 +1839,15 @@ class FakeMatrixApi extends MockClient { (var req) => spaceHierarchyResponse, }, 'POST': { - '/client/v3/delete_devices': (var req) => {}, - '/client/v3/account/3pid/add': (var req) => {}, - '/client/v3/account/3pid/bind': (var req) => {}, + '/client/v3/delete_devices': (var req) => {}, + '/client/v3/account/3pid/add': (var req) => {}, + '/client/v3/account/3pid/bind': (var req) => {}, '/client/v3/account/3pid/delete': (var req) => {'id_server_unbind_result': 'success'}, '/client/v3/account/3pid/unbind': (var req) => {'id_server_unbind_result': 'success'}, - '/client/v3/account/password': (var req) => {}, - '/client/v3/rooms/1234/report/1234': (var req) => {}, + '/client/v3/account/password': (var req) => {}, + '/client/v3/rooms/1234/report/1234': (var req) => {}, '/client/v3/search': (var req) => { 'search_categories': { 'room_events': { @@ -1923,8 +1923,9 @@ class FakeMatrixApi extends MockClient { 'submit_url': 'https://example.org/path/to/submitToken' }, '/client/v3/rooms/!localpart%3Aexample.com/receipt/m.read/%241234%3Aexample.com': - (var req) => {}, - '/client/v3/rooms/!localpart%3Aexample.com/read_markers': (var req) => {}, + (var req) => {}, + '/client/v3/rooms/!localpart%3Aexample.com/read_markers': (var req) => + {}, '/client/v3/user/${Uri.encodeComponent('alice@example.com')}/filter': (var req) => {'filter_id': '1234'}, '/client/v3/publicRooms?server=example.com': (var req) => { @@ -1950,7 +1951,7 @@ class FakeMatrixApi extends MockClient { ? request["one_time_keys"] as Map? : null; return { - 'failures': {}, + 'failures': {}, 'one_time_keys': { if (keys?['@alice:example.com'] != null) '@alice:example.com': { @@ -1983,13 +1984,20 @@ class FakeMatrixApi extends MockClient { } }; }, - '/client/v3/rooms/!localpart%3Aexample.com/invite': (var req) => {}, - '/client/v3/rooms/!localpart%3Aexample.com/leave': (var req) => {}, - '/client/v3/rooms/!localpart%3Aexample.com/forget': (var req) => {}, - '/client/v3/rooms/!localpart%3Aserver.abc/kick': (var req) => {}, - '/client/v3/rooms/!localpart%3Aexample.com/kick': (var req) => {}, - '/client/v3/rooms/!localpart%3Aexample.com/ban': (var req) => {}, - '/client/v3/rooms/!localpart%3Aexample.com/unban': (var req) => {}, + '/client/v3/rooms/!localpart%3Aexample.com/invite': (var req) => + {}, + '/client/v3/rooms/!localpart%3Aexample.com/leave': (var req) => + {}, + '/client/v3/rooms/!localpart%3Aexample.com/forget': (var req) => + {}, + '/client/v3/rooms/!localpart%3Aserver.abc/kick': (var req) => + {}, + '/client/v3/rooms/!localpart%3Aexample.com/kick': (var req) => + {}, + '/client/v3/rooms/!localpart%3Aexample.com/ban': (var req) => + {}, + '/client/v3/rooms/!localpart%3Aexample.com/unban': (var req) => + {}, '/client/v3/rooms/!localpart%3Aexample.com/join': (var req) => {'room_id': '!localpart:example.com'}, '/client/v3/join/!localpart%3Aexample.com?server_name=example.com&server_name=example.abc': @@ -2005,7 +2013,7 @@ class FakeMatrixApi extends MockClient { } }, '/client/v3/keys/query': (var req) => { - 'failures': {}, + 'failures': {}, 'device_keys': { '@alice:example.com': { 'JLAFKJWSCS': { @@ -2127,7 +2135,7 @@ class FakeMatrixApi extends MockClient { 'ed25519:82mAXjsmbTbrE6zyShpR869jnrANO75H8nYY0nDLoJ8': '82mAXjsmbTbrE6zyShpR869jnrANO75H8nYY0nDLoJ8', }, - 'signatures': {}, + 'signatures': {}, }, '@othertest:fakeServer.notExisting': { 'user_id': '@othertest:fakeServer.notExisting', @@ -2135,7 +2143,7 @@ class FakeMatrixApi extends MockClient { 'keys': { 'ed25519:master': 'master', }, - 'signatures': {}, + 'signatures': {}, }, }, 'self_signing_keys': { @@ -2159,7 +2167,7 @@ class FakeMatrixApi extends MockClient { 'keys': { 'ed25519:self_signing': 'self_signing', }, - 'signatures': {}, + 'signatures': {}, }, }, 'user_signing_keys': { @@ -2183,7 +2191,7 @@ class FakeMatrixApi extends MockClient { 'keys': { 'ed25519:user_signing': 'user_signing', }, - 'signatures': {}, + 'signatures': {}, }, }, }, @@ -2223,55 +2231,64 @@ class FakeMatrixApi extends MockClient { }, '/media/v3/upload?filename=file.jpeg': (var req) => {'content_uri': 'mxc://example.com/AQwafuaFswefuhsfAFAgsw'}, - '/client/v3/logout': (var reqI) => {}, - '/client/v3/pushers/set': (var reqI) => {}, + '/client/v3/logout': (var reqI) => {}, + '/client/v3/pushers/set': (var reqI) => {}, '/client/v3/join/1234': (var reqI) => {'room_id': '1234'}, - '/client/v3/logout/all': (var reqI) => {}, + '/client/v3/logout/all': (var reqI) => {}, '/client/v3/createRoom': (var reqI) => { 'room_id': '!1234:fakeServer.notExisting', }, - '/client/v3/rooms/!localpart%3Aserver.abc/read_markers': (var reqI) => {}, - '/client/v3/rooms/!localpart:server.abc/kick': (var reqI) => {}, - '/client/v3/rooms/!localpart%3Aserver.abc/ban': (var reqI) => {}, - '/client/v3/rooms/!localpart%3Aserver.abc/unban': (var reqI) => {}, - '/client/v3/rooms/!localpart%3Aserver.abc/invite': (var reqI) => {}, + '/client/v3/rooms/!localpart%3Aserver.abc/read_markers': (var reqI) => + {}, + '/client/v3/rooms/!localpart:server.abc/kick': (var reqI) => + {}, + '/client/v3/rooms/!localpart%3Aserver.abc/ban': (var reqI) => + {}, + '/client/v3/rooms/!localpart%3Aserver.abc/unban': (var reqI) => + {}, + '/client/v3/rooms/!localpart%3Aserver.abc/invite': (var reqI) => + {}, '/client/v3/keys/device_signing/upload': (var reqI) { - return {}; + return {}; }, - '/client/v3/keys/signatures/upload': (var reqI) => {'failures': {}}, + '/client/v3/keys/signatures/upload': (var reqI) => + {'failures': {}}, '/client/v3/room_keys/version': (var reqI) => {'version': '5'}, }, 'PUT': { '/client/v3/user/%40test%3AfakeServer.notExisting/account_data/m.ignored_user_list': - (var req) => {}, + (var req) => {}, '/client/v3/presence/${Uri.encodeComponent('@alice:example.com')}/status': - (var req) => {}, - '/client/v3/pushrules/global/content/nocake/enabled': (var req) => {}, - '/client/v3/pushrules/global/content/nocake/actions': (var req) => {}, + (var req) => {}, + '/client/v3/pushrules/global/content/nocake/enabled': (var req) => + {}, + '/client/v3/pushrules/global/content/nocake/actions': (var req) => + {}, '/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.history_visibility': - (var req) => {}, + (var req) => {}, '/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.join_rules': - (var req) => {}, + (var req) => {}, '/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.guest_access': - (var req) => {}, + (var req) => {}, '/client/v3/rooms/!localpart%3Aserver.abc/send/m.call.invite/1234': - (var req) => {}, + (var req) => {}, '/client/v3/rooms/!localpart%3Aserver.abc/send/m.call.answer/1234': - (var req) => {}, + (var req) => {}, '/client/v3/rooms/!localpart%3Aserver.abc/send/m.call.candidates/1234': - (var req) => {}, + (var req) => {}, '/client/v3/rooms/!localpart%3Aserver.abc/send/m.call.hangup/1234': - (var req) => {}, + (var req) => {}, '/client/v3/rooms/!1234%3Aexample.com/redact/1143273582443PhrSn%3Aexample.org/1234': (var req) => {'event_id': '1234'}, '/client/v3/pushrules/global/room/!localpart%3Aserver.abc': (var req) => - {}, + {}, '/client/v3/pushrules/global/override/.m.rule.master/enabled': - (var req) => {}, + (var req) => {}, '/client/v3/pushrules/global/content/nocake?before=1&after=2': - (var req) => {}, - '/client/v3/devices/QBUAZIFURK': (var req) => {}, - '/client/v3/directory/room/%23testalias%3Aexample.com': (var reqI) => {}, + (var req) => {}, + '/client/v3/devices/QBUAZIFURK': (var req) => {}, + '/client/v3/directory/room/%23testalias%3Aexample.com': (var reqI) => + {}, '/client/v3/rooms/!localpart%3Aserver.abc/send/m.room.message/testtxid': (var reqI) => { 'event_id': '\$event${FakeMatrixApi.eventCounter++}', @@ -2281,7 +2298,7 @@ class FakeMatrixApi extends MockClient { 'event_id': '\$event${FakeMatrixApi.eventCounter++}', }, '/client/v3/rooms/!localpart%3Aexample.com/typing/%40alice%3Aexample.com': - (var req) => {}, + (var req) => {}, '/client/v3/rooms/!1234%3Aexample.com/send/m.room.message/1234': (var reqI) => { 'event_id': '\$event${FakeMatrixApi.eventCounter++}', @@ -2291,25 +2308,27 @@ class FakeMatrixApi extends MockClient { 'event_id': '\$event${FakeMatrixApi.eventCounter++}', }, '/client/v3/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/tags/m.favourite': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags/testtag': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40alice%3Aexample.com/account_data/test.account.data': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40test%3AfakeServer.notExisting/account_data/best%20animal': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40alice%3Aexample.com/rooms/1234/account_data/test.account.data': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/account_data/com.famedly.marked_unread': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40test%3AfakeServer.notExisting/account_data/m.direct': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40othertest%3AfakeServer.notExisting/account_data/m.direct': - (var req) => {}, - '/client/v3/profile/%40alice%3Aexample.com/displayname': (var reqI) => {}, - '/client/v3/profile/%40alice%3Aexample.com/avatar_url': (var reqI) => {}, + (var req) => {}, + '/client/v3/profile/%40alice%3Aexample.com/displayname': (var reqI) => + {}, + '/client/v3/profile/%40alice%3Aexample.com/avatar_url': (var reqI) => + {}, '/client/v3/profile/%40test%3AfakeServer.notExisting/avatar_url': - (var reqI) => {}, + (var reqI) => {}, '/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.encryption': (var reqI) => {'event_id': 'YUwRidLecu:example.com'}, '/client/v3/rooms/!localpart%3Aserver.abc/state/m.room.avatar': @@ -2335,8 +2354,8 @@ class FakeMatrixApi extends MockClient { 'event_id': '42', }, '/client/v3/directory/list/room/!localpart%3Aexample.com': (var req) => - {}, - '/client/v3/room_keys/version/5': (var req) => {}, + {}, + '/client/v3/room_keys/version/5': (var req) => {}, '/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5': (var req) => { 'etag': 'asdf', @@ -2354,16 +2373,18 @@ class FakeMatrixApi extends MockClient { }, 'DELETE': { '/unknown/token': (var req) => {'errcode': 'M_UNKNOWN_TOKEN'}, - '/client/v3/devices/QBUAZIFURK': (var req) => {}, - '/client/v3/directory/room/%23testalias%3Aexample.com': (var reqI) => {}, - '/client/v3/pushrules/global/content/nocake': (var req) => {}, + '/client/v3/devices/QBUAZIFURK': (var req) => {}, + '/client/v3/directory/room/%23testalias%3Aexample.com': (var reqI) => + {}, + '/client/v3/pushrules/global/content/nocake': (var req) => + {}, '/client/v3/pushrules/global/override/!localpart%3Aserver.abc': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40test%3AfakeServer.notExisting/rooms/!localpart%3Aserver.abc/tags/m.favourite': - (var req) => {}, + (var req) => {}, '/client/v3/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags/testtag': - (var req) => {}, - '/client/v3/room_keys/version/5': (var req) => {}, + (var req) => {}, + '/client/v3/room_keys/version/5': (var req) => {}, '/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5': (var req) => { 'etag': 'asdf', diff --git a/lib/src/model/events/room_key_request_content.dart b/lib/src/model/events/room_key_request_content.dart index 5599cc03..bddaeff3 100644 --- a/lib/src/model/events/room_key_request_content.dart +++ b/lib/src/model/events/room_key_request_content.dart @@ -36,8 +36,9 @@ class RoomKeyRequestContent { String requestId; RoomKeyRequestContent.fromJson(Map json) - : body = ((x) => x != null ? RequestedKeyInfo.fromJson(x) : null)( - json.tryGet('body')), + : body = ((Map? x) => x != null + ? RequestedKeyInfo.fromJson(x) + : null)(json.tryGet('body')), action = json.tryGet('action', TryGet.required) ?? '', requestingDeviceId = json.tryGet('requesting_device_id', TryGet.required) ?? '', diff --git a/lib/src/model/events/secret_storage_key_content.dart b/lib/src/model/events/secret_storage_key_content.dart index d748da34..5f3529e3 100644 --- a/lib/src/model/events/secret_storage_key_content.dart +++ b/lib/src/model/events/secret_storage_key_content.dart @@ -38,8 +38,9 @@ class SecretStorageKeyContent { SecretStorageKeyContent(); SecretStorageKeyContent.fromJson(Map json) - : passphrase = ((x) => x != null ? PassphraseInfo.fromJson(x) : null)( - json.tryGet('passphrase')), + : passphrase = ((Map? x) => x != null + ? PassphraseInfo.fromJson(x) + : null)(json.tryGet('passphrase')), iv = json.tryGet('iv'), mac = json.tryGet('mac'), algorithm = json.tryGet('algorithm'); diff --git a/test/event_content_test.dart b/test/event_content_test.dart index 67fe9cc9..0c5ede11 100644 --- a/test/event_content_test.dart +++ b/test/event_content_test.dart @@ -238,7 +238,7 @@ void main() { 'type': 'some type', 'content': { 'images': { - 'emote': {}, + 'emote': {}, }, }, }; diff --git a/test/matrix_api_test.dart b/test/matrix_api_test.dart index af7de7c6..98331e3c 100644 --- a/test/matrix_api_test.dart +++ b/test/matrix_api_test.dart @@ -27,6 +27,8 @@ import 'package:matrix_api_lite/fake_matrix_api.dart'; import 'package:matrix_api_lite/matrix_api_lite.dart'; import 'package:test/test.dart'; +const emptyRequest = {}; + void main() { /// All Tests related to device keys group('Matrix API', () { @@ -123,7 +125,7 @@ void main() { final supportedVersions = await matrixApi.getVersions(); expect(supportedVersions.versions.contains('r0.5.0'), true); expect(supportedVersions.unstableFeatures!['m.lazy_load_members'], true); - expect(FakeMatrixApi.api['GET']!['/client/versions']!.call({}), + expect(FakeMatrixApi.api['GET']!['/client/versions']!.call(emptyRequest), supportedVersions.toJson()); matrixApi.homeserver = null; }); @@ -146,7 +148,7 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); final loginTypes = await matrixApi.getLoginFlows(); expect(loginTypes?.first.type, 'm.login.password'); - expect(FakeMatrixApi.api['GET']!['/client/v3/login']!.call({}), + expect(FakeMatrixApi.api['GET']!['/client/v3/login']!.call(emptyRequest), {'flows': loginTypes?.map((x) => x.toJson()).toList()}); matrixApi.homeserver = null; }); @@ -156,7 +158,7 @@ void main() { LoginType.mLoginPassword, identifier: AuthenticationUserIdentifier(user: 'username'), ); - expect(FakeMatrixApi.api['POST']!['/client/v3/login']!.call({}), + expect(FakeMatrixApi.api['POST']!['/client/v3/login']!.call(emptyRequest), loginResponse.toJson()); matrixApi.homeserver = null; }); @@ -178,7 +180,7 @@ void main() { await matrixApi.register(kind: AccountKind.guest, username: 'test'); expect( FakeMatrixApi.api['POST']!['/client/v3/register?kind=guest']! - .call({}), + .call(emptyRequest), registerResponse.toJson()); matrixApi.homeserver = null; }); @@ -195,7 +197,7 @@ void main() { ); expect( FakeMatrixApi.api['POST']!['/client/v3/register/email/requestToken']! - .call({}), + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -213,7 +215,7 @@ void main() { ); expect( FakeMatrixApi.api['POST']!['/client/v3/register/email/requestToken']! - .call({}), + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -282,7 +284,9 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; final response = await matrixApi.getAccount3PIDs(); - expect(FakeMatrixApi.api['GET']!['/client/v3/account/3pid']!.call({}), + expect( + FakeMatrixApi.api['GET']!['/client/v3/account/3pid']! + .call(emptyRequest), {'threepids': response?.map((t) => t.toJson()).toList()}); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -364,7 +368,9 @@ void main() { matrixApi.homeserver = Uri.parse('https://fakeserver.notexisting'); matrixApi.accessToken = '1234'; final response = await matrixApi.getCapabilities(); - expect(FakeMatrixApi.api['GET']!['/client/v3/capabilities']!.call({}), + expect( + FakeMatrixApi.api['GET']!['/client/v3/capabilities']! + .call(emptyRequest), {'capabilities': response.toJson()}); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -428,8 +434,8 @@ void main() { 'types': ['type1'], }, 'include_leave': true, - 'state': {}, - 'timeline': {}, + 'state': {}, + 'timeline': {}, }, 'presence': { 'limit': 10, @@ -500,7 +506,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/sync?filter=%7B%7D&since=1234&full_state=false&set_presence=unavailable&timeout=15']! - .call({}) as Map?, + .call(emptyRequest) as Map?, response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; }); @@ -578,7 +584,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/rooms/!localpart%3Aserver.abc/messages?from=1234&to=1234&dir=b&limit=10&filter=%7B%22lazy_load_members%22%3Atrue%7D']! - .call({}) as Map?, + .call(emptyRequest) as Map?, timelineHistoryResponse.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -669,7 +675,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/directory/room/%23testalias%3Aexample.com']! - .call({}), + .call(emptyRequest), roomAliasInformation.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -832,7 +838,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/publicRooms?limit=10&since=1234&server=example.com']! - .call({}), + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -855,7 +861,7 @@ void main() { expect( FakeMatrixApi .api['POST']!['/client/v3/publicRooms?server=example.com']! - .call({}), + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -870,7 +876,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v1/rooms/${Uri.encodeComponent('!gPxZhKUssFZKZcoCKY:neko.dev')}/hierarchy']! - .call({}), + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -886,7 +892,7 @@ void main() { expect( FakeMatrixApi.api['POST']!['/client/v3/user_directory/search']! - .call({}), + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -935,7 +941,7 @@ void main() { expect( FakeMatrixApi .api['GET']!['/client/v3/profile/%40alice%3Aexample.com']! - .call({}), + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -945,7 +951,9 @@ void main() { matrixApi.accessToken = '1234'; final response = await matrixApi.getTurnServer(); - expect(FakeMatrixApi.api['GET']!['/client/v3/voip/turnServer']!.call({}), + expect( + FakeMatrixApi.api['GET']!['/client/v3/voip/turnServer']! + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -1010,7 +1018,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/presence/${Uri.encodeComponent('@alice:example.com')}/status']! - .call({}), + .call(emptyRequest), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -1041,7 +1049,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/media/v3/preview_url?url=https%3A%2F%2Fmatrix.org&ts=10']! - .call({}), + .call(emptyRequest), openGraphData.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -1073,7 +1081,7 @@ void main() { final devices = await matrixApi.getDevices(); expect( - (FakeMatrixApi.api['GET']!['/client/v3/devices']!.call({}) + (FakeMatrixApi.api['GET']!['/client/v3/devices']!.call(emptyRequest) as Map?)?['devices'], devices?.map((i) => i.toJson()).toList()); @@ -1145,7 +1153,7 @@ void main() { 'Alices mobile phone'); expect( FakeMatrixApi.api['POST']!['/client/v3/keys/query']! - .call({'device_keys': {}}), + .call({'device_keys': emptyRequest}), response.toJson()); matrixApi.homeserver = matrixApi.accessToken = null; @@ -1189,7 +1197,7 @@ void main() { 'ed25519:82mAXjsmbTbrE6zyShpR869jnrANO75H8nYY0nDLoJ8': '82mAXjsmbTbrE6zyShpR869jnrANO75H8nYY0nDLoJ8', }, - 'signatures': {}, + 'signatures': {}, }); final selfSigningKey = MatrixCrossSigningKey.fromJson({ 'user_id': '@test:fakeServer.notExisting', @@ -1198,7 +1206,7 @@ void main() { 'ed25519:F9ypFzgbISXCzxQhhSnXMkc1vq12Luna3Nw5rqViOJY': 'F9ypFzgbISXCzxQhhSnXMkc1vq12Luna3Nw5rqViOJY', }, - 'signatures': {}, + 'signatures': {}, }); final userSigningKey = MatrixCrossSigningKey.fromJson({ 'user_id': '@test:fakeServer.notExisting', @@ -1207,7 +1215,7 @@ void main() { 'ed25519:0PiwulzJ/RU86LlzSSZ8St80HUMN3dqjKa/orIJoA0g': '0PiwulzJ/RU86LlzSSZ8St80HUMN3dqjKa/orIJoA0g', }, - 'signatures': {}, + 'signatures': {}, }); await matrixApi.uploadCrossSigningKeys( masterKey: masterKey, @@ -1220,7 +1228,8 @@ void main() { final response = await matrixApi.getPushers(); expect( - FakeMatrixApi.api['GET']!['/client/v3/pushers']!.call({}), + FakeMatrixApi.api['GET']!['/client/v3/pushers']! + .call({}), {'pushers': response?.map((i) => i.toJson()).toList()}, ); @@ -1259,7 +1268,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/notifications?from=1234&limit=10&only=1234']! - .call({}), + .call({}), response.toJson(), ); @@ -1271,7 +1280,8 @@ void main() { final response = await matrixApi.getPushRules(); expect( - FakeMatrixApi.api['GET']!['/client/v3/pushrules']!.call({}), + FakeMatrixApi.api['GET']!['/client/v3/pushrules']! + .call({}), {'global': response.toJson()}, ); @@ -1285,7 +1295,7 @@ void main() { await matrixApi.getPushRule('global', PushRuleKind.content, 'nocake'); expect( FakeMatrixApi.api['GET']!['/client/v3/pushrules/global/content/nocake']! - .call({}), + .call({}), response.toJson(), ); @@ -1386,7 +1396,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/events?from=1234&timeout=10&room_id=%211234']! - .call({}), + .call({}), response.toJson(), ); @@ -1401,7 +1411,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/user/%40alice%3Aexample.com/rooms/!localpart%3Aexample.com/tags']! - .call({}), + .call({}), {'tags': response?.map((k, v) => MapEntry(k, v.toJson()))}, ); @@ -1488,7 +1498,7 @@ void main() { expect( FakeMatrixApi .api['GET']!['/client/v3/admin/whois/%40alice%3Aexample.com']! - .call({}), + .call(emptyRequest), response.toJson(), ); @@ -1503,7 +1513,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/rooms/1234/context/1234?limit=10&filter=%7B%7D']! - .call({}), + .call(emptyRequest), response.toJson(), ); @@ -1528,7 +1538,8 @@ void main() { final response = await matrixApi.getProtocols(); expect( - FakeMatrixApi.api['GET']!['/client/v3/thirdparty/protocols']!.call({}), + FakeMatrixApi.api['GET']!['/client/v3/thirdparty/protocols']! + .call(emptyRequest), response.map((k, v) => MapEntry(k, v.toJson())), ); @@ -1541,7 +1552,7 @@ void main() { final response = await matrixApi.getProtocolMetadata('irc'); expect( FakeMatrixApi.api['GET']!['/client/v3/thirdparty/protocol/irc']! - .call({}), + .call(emptyRequest), response.toJson(), ); @@ -1554,7 +1565,7 @@ void main() { final response = await matrixApi.queryLocationByProtocol('irc'); expect( FakeMatrixApi.api['GET']!['/client/v3/thirdparty/location/irc']! - .call({}), + .call(emptyRequest), response.map((i) => i.toJson()).toList(), ); @@ -1566,7 +1577,8 @@ void main() { final response = await matrixApi.queryUserByProtocol('irc'); expect( - FakeMatrixApi.api['GET']!['/client/v3/thirdparty/user/irc']!.call({}), + FakeMatrixApi.api['GET']!['/client/v3/thirdparty/user/irc']! + .call(emptyRequest), response.map((i) => i.toJson()).toList(), ); @@ -1579,7 +1591,7 @@ void main() { final response = await matrixApi.queryLocationByAlias('1234'); expect( FakeMatrixApi.api['GET']!['/client/v3/thirdparty/location?alias=1234']! - .call({}), + .call(emptyRequest), response.map((i) => i.toJson()).toList(), ); @@ -1592,7 +1604,7 @@ void main() { final response = await matrixApi.queryUserByID('1234'); expect( FakeMatrixApi.api['GET']!['/client/v3/thirdparty/user?userid=1234']! - .call({}), + .call(emptyRequest), response.map((i) => i.toJson()).toList(), ); @@ -1605,7 +1617,7 @@ void main() { final response = await matrixApi.requestOpenIdToken('1234', {}); expect( FakeMatrixApi.api['POST']!['/client/v3/user/1234/openid/request_token']! - .call({}), + .call(emptyRequest), response.toJson(), ); @@ -1626,12 +1638,12 @@ void main() { final algorithm = BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2; final authData = { 'public_key': 'GXYaxqhNhUK28zUdxOmEsFRguz+PzBsDlTLlF0O0RkM', - 'signatures': {}, + 'signatures': {}, }; final ret = await matrixApi.postRoomKeysVersion(algorithm, authData); expect( - (FakeMatrixApi.api['POST']!['/client/v3/room_keys/version']!.call({}) - as Map)['version'], + (FakeMatrixApi.api['POST']!['/client/v3/room_keys/version']! + .call(emptyRequest) as Map)['version'], ret); }); test('getRoomKeysVersionCurrent', () async { @@ -1640,7 +1652,8 @@ void main() { final ret = await matrixApi.getRoomKeysVersionCurrent(); expect( - FakeMatrixApi.api['GET']!['/client/v3/room_keys/version']!.call({}), + FakeMatrixApi.api['GET']!['/client/v3/room_keys/version']! + .call(emptyRequest), ret.toJson()); }); test('putRoomKeysVersion', () async { @@ -1650,7 +1663,7 @@ void main() { final algorithm = BackupAlgorithm.mMegolmBackupV1Curve25519AesSha2; final authData = { 'public_key': 'GXYaxqhNhUK28zUdxOmEsFRguz+PzBsDlTLlF0O0RkM', - 'signatures': {}, + 'signatures': {}, }; await matrixApi.putRoomKeysVersion('5', algorithm, authData); }); @@ -1682,7 +1695,7 @@ void main() { expect( FakeMatrixApi.api['PUT']![ '/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('getRoomKeyBySessionId', () async { @@ -1695,7 +1708,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('deleteRoomKeyBySessionId', () async { @@ -1709,7 +1722,7 @@ void main() { expect( FakeMatrixApi.api['DELETE']![ '/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}/${Uri.encodeComponent('ciM/JWTPrmiWPPZNkRLDPQYf9AW/I46bxyLSr+Bx5oU')}?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('putRoomKeysByRoomId', () async { @@ -1737,7 +1750,7 @@ void main() { expect( FakeMatrixApi.api['PUT']![ '/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('getRoomKeysByRoomId', () async { @@ -1749,7 +1762,7 @@ void main() { expect( FakeMatrixApi.api['GET']![ '/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('deleteRoomKeysByRoomId', () async { @@ -1761,7 +1774,7 @@ void main() { expect( FakeMatrixApi.api['DELETE']![ '/client/v3/room_keys/keys/${Uri.encodeComponent('!726s6s6q:example.com')}?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('putRoomKeys', () async { @@ -1792,7 +1805,7 @@ void main() { final ret = await matrixApi.putRoomKeys('5', session); expect( FakeMatrixApi.api['PUT']!['/client/v3/room_keys/keys?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('getRoomKeys', () async { @@ -1802,7 +1815,7 @@ void main() { final ret = await matrixApi.getRoomKeys('5'); expect( FakeMatrixApi.api['GET']!['/client/v3/room_keys/keys?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('deleteRoomKeys', () async { @@ -1812,7 +1825,7 @@ void main() { final ret = await matrixApi.deleteRoomKeys('5'); expect( FakeMatrixApi.api['DELETE']!['/client/v3/room_keys/keys?version=5']! - .call({}), + .call(emptyRequest), ret.toJson()); }); test('AuthenticationData', () {