From 6a225e3b8cc120f98b677b317c640d67cb8c53e8 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 20 Aug 2022 11:56:34 +0200 Subject: [PATCH] chore: strict raw types --- analysis_options.yaml | 2 +- lib/fake_matrix_api.dart | 40 ++++++++++++++-------------- test/try_get_map_extension_test.dart | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 2de344a5..09e9d99d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -13,7 +13,7 @@ analyzer: language: strict-casts: false strict-inference: true - strict-raw-types: false + strict-raw-types: true errors: todo: ignore exclude: diff --git a/lib/fake_matrix_api.dart b/lib/fake_matrix_api.dart index 152eb8c4..3d7f420b 100644 --- a/lib/fake_matrix_api.dart +++ b/lib/fake_matrix_api.dart @@ -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': >[] } ] }; @@ -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': [ diff --git a/test/try_get_map_extension_test.dart b/test/try_get_map_extension_test.dart index 7fe70c28..c31e78e4 100644 --- a/test/try_get_map_extension_test.dart +++ b/test/try_get_map_extension_test.dart @@ -39,7 +39,7 @@ void main() { expect(data.tryGet('str'), 'foxies'); expect(data.tryGet('str'), null); expect(data.tryGet('int'), 42); - expect(data.tryGet('list'), [2, 3, 4]); + expect(data.tryGet>('list'), [2, 3, 4]); expect(data.tryGetMap('map')?.tryGet('beep'), 'boop'); expect(