From 7bc2d763df37fb3628eb6b16a6353f7eac92a125 Mon Sep 17 00:00:00 2001 From: Lea Date: Sun, 5 Feb 2023 20:36:56 +0100 Subject: [PATCH] Make the linter happy --- analysis_options.yaml | 2 +- lib/api/cache.dart | 3 ++- lib/main.dart | 4 ++-- lib/widgets/homepage_post.dart | 3 --- pubspec.lock | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 61b6c4d..b3e2b8d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -22,7 +22,7 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule + avoid_print: false # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at diff --git a/lib/api/cache.dart b/lib/api/cache.dart index b9b459d..1298652 100644 --- a/lib/api/cache.dart +++ b/lib/api/cache.dart @@ -52,8 +52,9 @@ class ObjectCache { class ItemCache extends ObjectCache { /// Get all items for a given feed List getForFeed(int feed) { - if (api.cache.feeds.get(feed) == null) + if (api.cache.feeds.get(feed) == null) { throw Exception('Feed $feed doesn\'t exist'); + } return _items.values.where((item) => item.feedId == feed).toList(); } diff --git a/lib/main.dart b/lib/main.dart index f9f8aa2..f4fce27 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,7 +14,7 @@ import 'api/api.dart'; // Limit the maximum amount of posts to fetch so we don't wait forever when // fetching a large list -const FETCH_MAX_POSTS = 1000; +const fetchMaxPosts = 1000; // Store these globally so our notification handler can access them BuildContext? globalContext; @@ -115,7 +115,7 @@ class _MyHomePageState extends State { .execute(); while ((data['items'] as List).isNotEmpty && - _fetchedCount < FETCH_MAX_POSTS) { + _fetchedCount < fetchMaxPosts) { print("Fetching more items"); var ids = widget.api.cache.items diff --git a/lib/widgets/homepage_post.dart b/lib/widgets/homepage_post.dart index cc86605..f30b359 100644 --- a/lib/widgets/homepage_post.dart +++ b/lib/widgets/homepage_post.dart @@ -1,12 +1,9 @@ -import 'dart:convert'; - import 'package:feet/pages/article.dart'; import 'package:feet/widgets/favicon.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../api/api.dart'; -// TODO use some localization library String formatDate(DateTime date) { return '${date.day}.${date.month}.${date.year}, ${date.hour}:${date.minute < 10 ? '0${date.minute}' : date.minute}'; } diff --git a/pubspec.lock b/pubspec.lock index 6f6f6ba..f90e4c8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -870,5 +870,5 @@ packages: source: hosted version: "5.4.1" sdks: - dart: ">=2.19.0-444.2.beta <4.0.0" + dart: ">=2.19.0-444.2.beta <3.0.0" flutter: ">=3.3.0"