在顫振中,watchboxbuilder 已被棄用,有人可以幫我解決這個問題嗎,完整的代碼在 143 行
child: WatchBoxBuilder(
box: Hive.box<Articles>('bookmarks'),
builder: (context, box) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
GestureDetector(
onTap: () => handleBookmarks(article),
child: Text(
article.title,
style: box.containsKey(article.url)
? AppTextStyle.newsTitle
.copyWith(color: AppColor.accent)
: AppTextStyle.newsTitle,
overflow: TextOverflow.ellipsis,
maxLines: 4,
),
uj5u.com熱心網友回復:
WatchBoxBuilder 替換為 box.listenable()。
這是新代碼,
child: ValueListenableBuilder(
valueListenable: Hive.box<Articles>('bookmarks').listenable(),
builder: (context, box,child) => Column(
有關更多資訊 https://pub.dev/packages/hive_flutter/changelog#0301
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/469124.html
