Format remaining files to 120 line limit

This commit is contained in:
Tommy Chow
2023-01-19 23:30:05 -05:00
parent aadac3e484
commit 25e6bc478b
5 changed files with 30 additions and 15 deletions

View File

@ -97,8 +97,8 @@ class TwitchApi {
if (response.statusCode == 200) {
final result = <String, Badge>{};
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 = <String, Badge>{};
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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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);

View File

@ -52,7 +52,8 @@ abstract class ListStoreBase with Store {
/// The list of the fetched streams with blocked users filtered out.
@computed
ObservableList<StreamTwitch> 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();

View File

@ -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)));

View File

@ -96,7 +96,12 @@ void main() {
final List<EmoteBTTV> 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) {

View File

@ -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');
});
}