Using read<int> instead readInt

by the document and api document, readInt may replace with read<int>?

`
Use read<int>(key) directly
`
This commit is contained in:
cnmade 2022-06-19 16:13:58 +08:00 committed by GitHub
parent 81c59c0b99
commit 6583fa5ec8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -83,7 +83,7 @@ Stream<List<CategoryWithCount>> categoriesWithCount() {
// CategoryWithCount. As we defined the Category table earlier, drift knows how to parse // CategoryWithCount. As we defined the Category table earlier, drift knows how to parse
// a category. The only thing left to do manually is extracting the amount // a category. The only thing left to do manually is extracting the amount
return rows return rows
.map((row) => CategoryWithCount(Category.fromData(row.data, this), row.readInt('amount'))) .map((row) => CategoryWithCount(Category.fromData(row.data, this), row.read<int>('amount')))
.toList(); .toList();
}); });
} }
@ -100,7 +100,7 @@ Stream<int> amountOfTodosInCategory(int id) {
'SELECT COUNT(*) AS c FROM todos WHERE category = ?', 'SELECT COUNT(*) AS c FROM todos WHERE category = ?',
variables: [Variable.withInt(id)], variables: [Variable.withInt(id)],
readsFrom: {todos}, readsFrom: {todos},
).map((row) => row.readInt('c')).watch(); ).map((row) => row.read<int>('c')).watch();
} }
``` ```