Make the linter happy

This commit is contained in:
Lea 2023-02-05 20:36:56 +01:00
parent 43702e5ba0
commit 7bc2d763df
Signed by: Lea
GPG key ID: 1BAFFE8347019C42
5 changed files with 6 additions and 8 deletions

View file

@ -22,7 +22,7 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file # `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint. # producing the lint.
rules: 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 # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at # Additional information about this file can be found at

View file

@ -52,8 +52,9 @@ class ObjectCache<K, T> {
class ItemCache extends ObjectCache<int, Item> { class ItemCache extends ObjectCache<int, Item> {
/// Get all items for a given feed /// Get all items for a given feed
List<Item> getForFeed(int feed) { List<Item> getForFeed(int feed) {
if (api.cache.feeds.get(feed) == null) if (api.cache.feeds.get(feed) == null) {
throw Exception('Feed $feed doesn\'t exist'); throw Exception('Feed $feed doesn\'t exist');
}
return _items.values.where((item) => item.feedId == feed).toList(); return _items.values.where((item) => item.feedId == feed).toList();
} }

View file

@ -14,7 +14,7 @@ import 'api/api.dart';
// Limit the maximum amount of posts to fetch so we don't wait forever when // Limit the maximum amount of posts to fetch so we don't wait forever when
// fetching a large list // fetching a large list
const FETCH_MAX_POSTS = 1000; const fetchMaxPosts = 1000;
// Store these globally so our notification handler can access them // Store these globally so our notification handler can access them
BuildContext? globalContext; BuildContext? globalContext;
@ -115,7 +115,7 @@ class _MyHomePageState extends State<MyHomePage> {
.execute(); .execute();
while ((data['items'] as List<dynamic>).isNotEmpty && while ((data['items'] as List<dynamic>).isNotEmpty &&
_fetchedCount < FETCH_MAX_POSTS) { _fetchedCount < fetchMaxPosts) {
print("Fetching more items"); print("Fetching more items");
var ids = widget.api.cache.items var ids = widget.api.cache.items

View file

@ -1,12 +1,9 @@
import 'dart:convert';
import 'package:feet/pages/article.dart'; import 'package:feet/pages/article.dart';
import 'package:feet/widgets/favicon.dart'; import 'package:feet/widgets/favicon.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import '../api/api.dart'; import '../api/api.dart';
// TODO use some localization library
String formatDate(DateTime date) { String formatDate(DateTime date) {
return '${date.day}.${date.month}.${date.year}, ${date.hour}:${date.minute < 10 ? '0${date.minute}' : date.minute}'; return '${date.day}.${date.month}.${date.year}, ${date.hour}:${date.minute < 10 ? '0${date.minute}' : date.minute}';
} }

View file

@ -870,5 +870,5 @@ packages:
source: hosted source: hosted
version: "5.4.1" version: "5.4.1"
sdks: 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" flutter: ">=3.3.0"