From 25e6bc478bc6d86d947db9cd1fcdf7a3db562f95 Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Thu, 19 Jan 2023 23:30:05 -0500 Subject: [PATCH] Format remaining files to 120 line limit --- lib/apis/twitch_api.dart | 28 +++++++++++-------- .../home/stream_list/stream_list_store.dart | 3 +- lib/screens/settings/stores/user_store.dart | 4 ++- test/emote_test.dart | 7 ++++- test/user_test.dart | 3 +- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/lib/apis/twitch_api.dart b/lib/apis/twitch_api.dart index a245a68..793d223 100644 --- a/lib/apis/twitch_api.dart +++ b/lib/apis/twitch_api.dart @@ -97,8 +97,8 @@ class TwitchApi { if (response.statusCode == 200) { final result = {}; final decoded = jsonDecode(response.body)['badge_sets'] as Map; - decoded.forEach((id, versions) => - (versions['versions'] as Map).forEach((version, badgeInfo) => result['$id/$version'] = Badge.fromTwitch(BadgeInfoTwitch.fromJson(badgeInfo)))); + decoded.forEach((id, versions) => (versions['versions'] as Map).forEach( + (version, badgeInfo) => result['$id/$version'] = Badge.fromTwitch(BadgeInfoTwitch.fromJson(badgeInfo)))); return result; } else { @@ -114,8 +114,8 @@ class TwitchApi { if (response.statusCode == 200) { final result = {}; final decoded = jsonDecode(response.body)['badge_sets'] as Map; - decoded.forEach((id, versions) => - (versions['versions'] as Map).forEach((version, badgeInfo) => result['$id/$version'] = Badge.fromTwitch(BadgeInfoTwitch.fromJson(badgeInfo)))); + decoded.forEach((id, versions) => (versions['versions'] as Map).forEach( + (version, badgeInfo) => result['$id/$version'] = Badge.fromTwitch(BadgeInfoTwitch.fromJson(badgeInfo)))); return result; } else { @@ -175,7 +175,8 @@ class TwitchApi { required Map headers, String? cursor, }) async { - final url = Uri.parse(cursor == null ? 'https://api.twitch.tv/helix/streams' : 'https://api.twitch.tv/helix/streams?after=$cursor'); + final url = Uri.parse( + cursor == null ? 'https://api.twitch.tv/helix/streams' : 'https://api.twitch.tv/helix/streams?after=$cursor'); final response = await _client.get(url, headers: headers); final decoded = jsonDecode(response.body); @@ -192,8 +193,9 @@ class TwitchApi { required Map headers, String? cursor, }) async { - final url = Uri.parse( - cursor == null ? 'https://api.twitch.tv/helix/streams/followed?user_id=$id' : 'https://api.twitch.tv/helix/streams/followed?user_id=$id&after=$cursor'); + final url = Uri.parse(cursor == null + ? 'https://api.twitch.tv/helix/streams/followed?user_id=$id' + : 'https://api.twitch.tv/helix/streams/followed?user_id=$id&after=$cursor'); final response = await _client.get(url, headers: headers); final decoded = jsonDecode(response.body); @@ -210,8 +212,9 @@ class TwitchApi { required Map headers, String? cursor, }) async { - final url = - Uri.parse(cursor == null ? 'https://api.twitch.tv/helix/streams?game_id=$gameId' : 'https://api.twitch.tv/helix/streams?game_id=$gameId&after=$cursor'); + final url = Uri.parse(cursor == null + ? 'https://api.twitch.tv/helix/streams?game_id=$gameId' + : 'https://api.twitch.tv/helix/streams?game_id=$gameId&after=$cursor'); final response = await _client.get(url, headers: headers); final decoded = jsonDecode(response.body); @@ -250,7 +253,8 @@ class TwitchApi { String? id, required Map headers, }) async { - final url = Uri.parse(id != null ? 'https://api.twitch.tv/helix/users?id=$id' : 'https://api.twitch.tv/helix/users?login=$userLogin'); + final url = Uri.parse( + id != null ? 'https://api.twitch.tv/helix/users?id=$id' : 'https://api.twitch.tv/helix/users?login=$userLogin'); final response = await _client.get(url, headers: headers); final decoded = jsonDecode(response.body); @@ -312,7 +316,9 @@ class TwitchApi { required Map headers, String? cursor, }) async { - final url = Uri.parse(cursor == null ? 'https://api.twitch.tv/helix/games/top' : 'https://api.twitch.tv/helix/games/top?after=$cursor'); + final url = Uri.parse(cursor == null + ? 'https://api.twitch.tv/helix/games/top' + : 'https://api.twitch.tv/helix/games/top?after=$cursor'); final response = await _client.get(url, headers: headers); final decoded = jsonDecode(response.body); diff --git a/lib/screens/home/stream_list/stream_list_store.dart b/lib/screens/home/stream_list/stream_list_store.dart index 453b142..4d9fd83 100644 --- a/lib/screens/home/stream_list/stream_list_store.dart +++ b/lib/screens/home/stream_list/stream_list_store.dart @@ -52,7 +52,8 @@ abstract class ListStoreBase with Store { /// The list of the fetched streams with blocked users filtered out. @computed ObservableList get streams => _allStreams - .where((streamInfo) => !authStore.user.blockedUsers.map((blockedUser) => blockedUser.userId).contains(streamInfo.userId)) + .where((streamInfo) => + !authStore.user.blockedUsers.map((blockedUser) => blockedUser.userId).contains(streamInfo.userId)) .toList() .asObservable(); diff --git a/lib/screens/settings/stores/user_store.dart b/lib/screens/settings/stores/user_store.dart index f2cb084..5c6b596 100644 --- a/lib/screens/settings/stores/user_store.dart +++ b/lib/screens/settings/stores/user_store.dart @@ -29,7 +29,9 @@ abstract class UserStoreBase with Store { // Get and update the current user's list of blocked users. // Don't use await because having a huge list of blocked users will block the UI. if (_details?.id != null) { - twitchApi.getUserBlockedList(id: _details!.id, headers: headers).then((blockedUsers) => _blockedUsers = blockedUsers.asObservable()); + twitchApi + .getUserBlockedList(id: _details!.id, headers: headers) + .then((blockedUsers) => _blockedUsers = blockedUsers.asObservable()); } _disposeReaction = autorun((_) => _blockedUsers.sort((a, b) => a.userLogin.compareTo(b.userLogin))); diff --git a/test/emote_test.dart b/test/emote_test.dart index 2b01230..c318349 100644 --- a/test/emote_test.dart +++ b/test/emote_test.dart @@ -96,7 +96,12 @@ void main() { final List emotes = decoded.map((emote) => EmoteBTTV.fromJson(emote)).toList(); expect(emotes.length, 4); - final emoteIds = ['54fa903b01e468494b85b53f', '54fa909b01e468494b85b542', '54fa90ba01e468494b85b543', '54fa90f201e468494b85b545']; + final emoteIds = [ + '54fa903b01e468494b85b53f', + '54fa909b01e468494b85b542', + '54fa90ba01e468494b85b543', + '54fa90f201e468494b85b545' + ]; final emoteCodes = ['DatSauce', 'ForeverAlone', 'GabeN', 'HailHelix']; emotes.asMap().forEach((index, emote) { diff --git a/test/user_test.dart b/test/user_test.dart index de26803..cb6066b 100644 --- a/test/user_test.dart +++ b/test/user_test.dart @@ -26,6 +26,7 @@ void main() { expect(user.id, '88888888'); expect(user.login, 'bob'); expect(user.displayName, 'Bob'); - expect(user.profileImageUrl, 'https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png'); + expect(user.profileImageUrl, + 'https://static-cdn.jtvnw.net/user-default-pictures-uv/ead5c8b2-a4c9-4724-b1dd-9f00b46cbd3d-profile_image-300x300.png'); }); }