upgrade min sdk; run formatter

This commit is contained in:
Fabian Freund
2025-06-02 22:25:10 +02:00
parent 8fccd767af
commit ad03cc9bac
171 changed files with 4817 additions and 4685 deletions
@@ -44,9 +44,8 @@ class ArticleDao extends DatabaseAccessor<FeedDatabase> with _$ArticleDaoMixin {
return db.transaction(() async {
await Future.wait(
articles.map((newArticle) {
final statement =
db.article.update()
..where((article) => article.id.equals(newArticle.id));
final statement = db.article.update()
..where((article) => article.id.equals(newArticle.id));
return statement.write(
ArticleCompanion(
@@ -86,12 +85,11 @@ class ArticleDao extends DatabaseAccessor<FeedDatabase> with _$ArticleDaoMixin {
updated: Value(article.updated),
);
},
where:
(old) =>
old.updated.isNotNull() &
old.updated.isSmallerThanValue(
article.updated ?? DateTime(0),
),
where: (old) =>
old.updated.isNotNull() &
old.updated.isSmallerThanValue(
article.updated ?? DateTime(0),
),
),
),
)
@@ -101,8 +99,8 @@ class ArticleDao extends DatabaseAccessor<FeedDatabase> with _$ArticleDaoMixin {
}
Future<int> updateArticleRead(String articleId, DateTime? read) {
final statement =
db.article.update()..where((article) => article.id.equals(articleId));
final statement = db.article.update()
..where((article) => article.id.equals(articleId));
return statement.write(ArticleCompanion(lastRead: Value(read)));
}
@@ -110,15 +108,14 @@ class ArticleDao extends DatabaseAccessor<FeedDatabase> with _$ArticleDaoMixin {
Selectable<(String, int)> getUnreadArticleCount() {
final count = countAll();
final countByFeed =
db.article.selectOnly()
..addColumns([db.article.feedId, count])
..where(
db.article.lastRead.isNull() |
(db.article.updated.isNotNull() &
db.article.lastRead.isSmallerThan(db.article.lastRead)),
)
..groupBy([db.article.feedId]);
final countByFeed = db.article.selectOnly()
..addColumns([db.article.feedId, count])
..where(
db.article.lastRead.isNull() |
(db.article.updated.isNotNull() &
db.article.lastRead.isSmallerThan(db.article.lastRead)),
)
..groupBy([db.article.feedId]);
return countByFeed.map(
(result) => (result.read(db.article.feedId)!, result.read(count)!),
@@ -16,8 +16,8 @@ class FeedDao extends DatabaseAccessor<FeedDatabase> with _$FeedDaoMixin {
}
Future<int> updateFeedFetched(Uri feedId, DateTime fetched) {
final statement =
db.feed.update()..where((feed) => feed.url.equalsValue(feedId));
final statement = db.feed.update()
..where((feed) => feed.url.equalsValue(feedId));
return statement.write(FeedCompanion(lastFetched: Value(fetched)));
}
@@ -273,14 +273,16 @@ class FeedData extends DataClass implements Insertable<FeedData> {
return FeedData(
url: data.url.present ? data.url.value : this.url,
title: data.title.present ? data.title.value : this.title,
description:
data.description.present ? data.description.value : this.description,
description: data.description.present
? data.description.value
: this.description,
icon: data.icon.present ? data.icon.value : this.icon,
siteLink: data.siteLink.present ? data.siteLink.value : this.siteLink,
authors: data.authors.present ? data.authors.value : this.authors,
tags: data.tags.present ? data.tags.value : this.tags,
lastFetched:
data.lastFetched.present ? data.lastFetched.value : this.lastFetched,
lastFetched: data.lastFetched.present
? data.lastFetched.value
: this.lastFetched,
);
}
@@ -625,22 +627,20 @@ class Article extends Table with TableInfo<Article, FeedArticle> {
FeedArticle map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return FeedArticle(
id:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
feedId: Article.$converterfeedId.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}feed_id'],
)!,
),
fetched:
attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}fetched'],
)!,
fetched: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}fetched'],
)!,
created: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}created'],
@@ -992,22 +992,20 @@ class ArticleView extends ViewInfo<ArticleView, FeedArticle>
FeedArticle map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return FeedArticle(
id:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
feedId: Article.$converterfeedId.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}feed_id'],
)!,
),
fetched:
attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}fetched'],
)!,
fetched: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}fetched'],
)!,
created: attachedDatabase.typeMapping.read(
DriftSqlType.dateTime,
data['${effectivePrefix}created'],
@@ -1251,21 +1249,18 @@ class ArticleFts extends Table
ArticleFt map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ArticleFt(
title:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
)!,
summaryPlain:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}summaryPlain'],
)!,
contentPlain:
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}contentPlain'],
)!,
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
)!,
summaryPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}summaryPlain'],
)!,
contentPlain: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}contentPlain'],
)!,
);
}
@@ -1332,14 +1327,12 @@ class ArticleFt extends DataClass implements Insertable<ArticleFt> {
ArticleFt copyWithCompanion(ArticleFtsCompanion data) {
return ArticleFt(
title: data.title.present ? data.title.value : this.title,
summaryPlain:
data.summaryPlain.present
? data.summaryPlain.value
: this.summaryPlain,
contentPlain:
data.contentPlain.present
? data.contentPlain.value
: this.contentPlain,
summaryPlain: data.summaryPlain.present
? data.summaryPlain.value
: this.summaryPlain,
contentPlain: data.contentPlain.present
? data.contentPlain.value
: this.contentPlain,
);
}
@@ -1886,12 +1879,12 @@ class $FeedTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $FeedFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $FeedOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $FeedAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$FeedFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$FeedOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$FeedAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<Uri> url = const Value.absent(),
@@ -1936,16 +1929,9 @@ class $FeedTableManager
lastFetched: lastFetched,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
$FeedReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), $FeedReferences(db, table, e)))
.toList(),
prefetchHooksCallback: ({articleRefs = false}) {
return PrefetchHooks(
db: db,
@@ -1957,12 +1943,10 @@ class $FeedTableManager
await $_getPrefetchedData<FeedData, Feed, FeedArticle>(
currentTable: table,
referencedTable: $FeedReferences._articleRefsTable(db),
managerFromTypedResult:
(p0) => $FeedReferences(db, table, p0).articleRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.feedId == item.url,
),
managerFromTypedResult: (p0) =>
$FeedReferences(db, table, p0).articleRefs,
referencedItemsForCurrentItem: (item, referencedItems) =>
referencedItems.where((e) => e.feedId == item.url),
typedResults: items,
),
];
@@ -2380,12 +2364,12 @@ class $ArticleTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $ArticleFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $ArticleOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $ArticleAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$ArticleFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$ArticleOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$ArticleAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
@@ -2462,51 +2446,47 @@ class $ArticleTableManager
contentPlain: contentPlain,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
$ArticleReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map(
(e) => (e.readTable(table), $ArticleReferences(db, table, e)),
)
.toList(),
prefetchHooksCallback: ({feedId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins: <
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (feedId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.feedId,
referencedTable: $ArticleReferences._feedIdTable(
db,
),
referencedColumn:
$ArticleReferences._feedIdTable(db).url,
)
as T;
}
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (feedId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.feedId,
referencedTable: $ArticleReferences
._feedIdTable(db),
referencedColumn: $ArticleReferences
._feedIdTable(db)
.url,
)
as T;
}
return state;
},
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
@@ -2636,12 +2616,12 @@ class $ArticleFtsTableManager
TableManagerState(
db: db,
table: table,
createFilteringComposer:
() => $ArticleFtsFilterComposer($db: db, $table: table),
createOrderingComposer:
() => $ArticleFtsOrderingComposer($db: db, $table: table),
createComputedFieldComposer:
() => $ArticleFtsAnnotationComposer($db: db, $table: table),
createFilteringComposer: () =>
$ArticleFtsFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$ArticleFtsOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$ArticleFtsAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> title = const Value.absent(),
@@ -2666,16 +2646,9 @@ class $ArticleFtsTableManager
contentPlain: contentPlain,
rowid: rowid,
),
withReferenceMapper:
(p0) =>
p0
.map(
(e) => (
e.readTable(table),
BaseReferences(db, table, e),
),
)
.toList(),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
@@ -165,96 +165,78 @@ class _$FeedArticleCWProxyImpl implements _$FeedArticleCWProxy {
Object? siteLink = const $CopyWithPlaceholder(),
}) {
return FeedArticle(
id:
id == const $CopyWithPlaceholder()
? _value.id
// ignore: cast_nullable_to_non_nullable
: id as String,
feedId:
feedId == const $CopyWithPlaceholder()
? _value.feedId
// ignore: cast_nullable_to_non_nullable
: feedId as Uri,
fetched:
fetched == const $CopyWithPlaceholder()
? _value.fetched
// ignore: cast_nullable_to_non_nullable
: fetched as DateTime,
created:
created == const $CopyWithPlaceholder()
? _value.created
// ignore: cast_nullable_to_non_nullable
: created as DateTime?,
updated:
updated == const $CopyWithPlaceholder()
? _value.updated
// ignore: cast_nullable_to_non_nullable
: updated as DateTime?,
lastRead:
lastRead == const $CopyWithPlaceholder()
? _value.lastRead
// ignore: cast_nullable_to_non_nullable
: lastRead as DateTime?,
title:
title == const $CopyWithPlaceholder()
? _value.title
// ignore: cast_nullable_to_non_nullable
: title as String?,
authors:
authors == const $CopyWithPlaceholder()
? _value.authors
// ignore: cast_nullable_to_non_nullable
: authors as List<FeedAuthor>?,
tags:
tags == const $CopyWithPlaceholder()
? _value.tags
// ignore: cast_nullable_to_non_nullable
: tags as List<FeedCategory>?,
links:
links == const $CopyWithPlaceholder()
? _value.links
// ignore: cast_nullable_to_non_nullable
: links as List<FeedLink>?,
summaryHtml:
summaryHtml == const $CopyWithPlaceholder()
? _value.summaryHtml
// ignore: cast_nullable_to_non_nullable
: summaryHtml as String?,
summaryMarkdown:
summaryMarkdown == const $CopyWithPlaceholder()
? _value.summaryMarkdown
// ignore: cast_nullable_to_non_nullable
: summaryMarkdown as String?,
summaryPlain:
summaryPlain == const $CopyWithPlaceholder()
? _value.summaryPlain
// ignore: cast_nullable_to_non_nullable
: summaryPlain as String?,
contentHtml:
contentHtml == const $CopyWithPlaceholder()
? _value.contentHtml
// ignore: cast_nullable_to_non_nullable
: contentHtml as String?,
contentMarkdown:
contentMarkdown == const $CopyWithPlaceholder()
? _value.contentMarkdown
// ignore: cast_nullable_to_non_nullable
: contentMarkdown as String?,
contentPlain:
contentPlain == const $CopyWithPlaceholder()
? _value.contentPlain
// ignore: cast_nullable_to_non_nullable
: contentPlain as String?,
icon:
icon == const $CopyWithPlaceholder()
? _value.icon
// ignore: cast_nullable_to_non_nullable
: icon as Uri?,
siteLink:
siteLink == const $CopyWithPlaceholder()
? _value.siteLink
// ignore: cast_nullable_to_non_nullable
: siteLink as Uri?,
id: id == const $CopyWithPlaceholder()
? _value.id
// ignore: cast_nullable_to_non_nullable
: id as String,
feedId: feedId == const $CopyWithPlaceholder()
? _value.feedId
// ignore: cast_nullable_to_non_nullable
: feedId as Uri,
fetched: fetched == const $CopyWithPlaceholder()
? _value.fetched
// ignore: cast_nullable_to_non_nullable
: fetched as DateTime,
created: created == const $CopyWithPlaceholder()
? _value.created
// ignore: cast_nullable_to_non_nullable
: created as DateTime?,
updated: updated == const $CopyWithPlaceholder()
? _value.updated
// ignore: cast_nullable_to_non_nullable
: updated as DateTime?,
lastRead: lastRead == const $CopyWithPlaceholder()
? _value.lastRead
// ignore: cast_nullable_to_non_nullable
: lastRead as DateTime?,
title: title == const $CopyWithPlaceholder()
? _value.title
// ignore: cast_nullable_to_non_nullable
: title as String?,
authors: authors == const $CopyWithPlaceholder()
? _value.authors
// ignore: cast_nullable_to_non_nullable
: authors as List<FeedAuthor>?,
tags: tags == const $CopyWithPlaceholder()
? _value.tags
// ignore: cast_nullable_to_non_nullable
: tags as List<FeedCategory>?,
links: links == const $CopyWithPlaceholder()
? _value.links
// ignore: cast_nullable_to_non_nullable
: links as List<FeedLink>?,
summaryHtml: summaryHtml == const $CopyWithPlaceholder()
? _value.summaryHtml
// ignore: cast_nullable_to_non_nullable
: summaryHtml as String?,
summaryMarkdown: summaryMarkdown == const $CopyWithPlaceholder()
? _value.summaryMarkdown
// ignore: cast_nullable_to_non_nullable
: summaryMarkdown as String?,
summaryPlain: summaryPlain == const $CopyWithPlaceholder()
? _value.summaryPlain
// ignore: cast_nullable_to_non_nullable
: summaryPlain as String?,
contentHtml: contentHtml == const $CopyWithPlaceholder()
? _value.contentHtml
// ignore: cast_nullable_to_non_nullable
: contentHtml as String?,
contentMarkdown: contentMarkdown == const $CopyWithPlaceholder()
? _value.contentMarkdown
// ignore: cast_nullable_to_non_nullable
: contentMarkdown as String?,
contentPlain: contentPlain == const $CopyWithPlaceholder()
? _value.contentPlain
// ignore: cast_nullable_to_non_nullable
: contentPlain as String?,
icon: icon == const $CopyWithPlaceholder()
? _value.icon
// ignore: cast_nullable_to_non_nullable
: icon as Uri?,
siteLink: siteLink == const $CopyWithPlaceholder()
? _value.siteLink
// ignore: cast_nullable_to_non_nullable
: siteLink as Uri?,
);
}
}
@@ -273,31 +255,25 @@ FeedArticle _$FeedArticleFromJson(Map<String, dynamic> json) => FeedArticle(
id: json['id'] as String,
feedId: Uri.parse(json['feedId'] as String),
fetched: DateTime.parse(json['fetched'] as String),
created:
json['created'] == null
? null
: DateTime.parse(json['created'] as String),
updated:
json['updated'] == null
? null
: DateTime.parse(json['updated'] as String),
lastRead:
json['lastRead'] == null
? null
: DateTime.parse(json['lastRead'] as String),
created: json['created'] == null
? null
: DateTime.parse(json['created'] as String),
updated: json['updated'] == null
? null
: DateTime.parse(json['updated'] as String),
lastRead: json['lastRead'] == null
? null
: DateTime.parse(json['lastRead'] as String),
title: json['title'] as String?,
authors:
(json['authors'] as List<dynamic>?)
?.map((e) => FeedAuthor.fromJson(e as Map<String, dynamic>))
.toList(),
tags:
(json['tags'] as List<dynamic>?)
?.map((e) => FeedCategory.fromJson(e as Map<String, dynamic>))
.toList(),
links:
(json['links'] as List<dynamic>?)
?.map((e) => FeedLink.fromJson(e as Map<String, dynamic>))
.toList(),
authors: (json['authors'] as List<dynamic>?)
?.map((e) => FeedAuthor.fromJson(e as Map<String, dynamic>))
.toList(),
tags: (json['tags'] as List<dynamic>?)
?.map((e) => FeedCategory.fromJson(e as Map<String, dynamic>))
.toList(),
links: (json['links'] as List<dynamic>?)
?.map((e) => FeedLink.fromJson(e as Map<String, dynamic>))
.toList(),
summaryHtml: json['summaryHtml'] as String?,
summaryMarkdown: json['summaryMarkdown'] as String?,
summaryPlain: json['summaryPlain'] as String?,
@@ -305,8 +281,9 @@ FeedArticle _$FeedArticleFromJson(Map<String, dynamic> json) => FeedArticle(
contentMarkdown: json['contentMarkdown'] as String?,
contentPlain: json['contentPlain'] as String?,
icon: json['icon'] == null ? null : Uri.parse(json['icon'] as String),
siteLink:
json['siteLink'] == null ? null : Uri.parse(json['siteLink'] as String),
siteLink: json['siteLink'] == null
? null
: Uri.parse(json['siteLink'] as String),
);
Map<String, dynamic> _$FeedArticleToJson(FeedArticle instance) =>
@@ -11,10 +11,9 @@ FeedParseResult _$FeedParseResultFromJson(Map<String, dynamic> json) =>
feedData: const FeedDataConverter().fromJson(
json['feedData'] as Map<String, dynamic>,
),
articleData:
(json['articleData'] as List<dynamic>)
.map((e) => FeedArticle.fromJson(e as Map<String, dynamic>))
.toList(),
articleData: (json['articleData'] as List<dynamic>)
.map((e) => FeedArticle.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$FeedParseResultToJson(FeedParseResult instance) =>
@@ -13,8 +13,9 @@ String _$feedDatabaseHash() => r'c3b20e867da5af6e92d1e8c1efa96b79988837a1';
final feedDatabaseProvider = Provider<FeedDatabase>.internal(
feedDatabase,
name: r'feedDatabaseProvider',
debugGetCreateSourceHash:
const bool.fromEnvironment('dart.vm.product') ? null : _$feedDatabaseHash,
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$feedDatabaseHash,
dependencies: null,
allTransitiveDependencies: null,
);