'WatchBoxBuilder is deprecated and shouldn't be used
In flutter watchboxbuilder is deprecated, can someone help me with this,the full code is here on the 143 line
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,
),
Solution 1:[1]
WatchBoxBuilder is replaced with box.listenable().
Here is new code,
child: ValueListenableBuilder(
valueListenable: Hive.box<Articles>('bookmarks').listenable(),
builder: (context, box,child) => Column(
For more info https://pub.dev/packages/hive_flutter/changelog#0301
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Durai Murugan |
