如何解决此问题?我尝试添加create
以及如何传递这些参数?
ProxyProvider<YelloChatDb, UserDao>(
builder: (context, yelloChatDb, userdAO) => UserDao(yelloChatDb),
),
ProxyProvider<YelloVendorClient, VendorService>(
builder: (context, yelloVendorClient, categoryService) =>
VendorService.create(yelloVendorClient.chopperClient),
dispose: (context, categoryService) => categoryService.client.dispose()),
道课
@UseDao(tables: [Users])
class UserDao extends DatabaseAccessor<YelloChatDb> with _$UserDaoMixin {
UserDao(YelloChatDb db) : super(db);
...
}
答案 0 :(得分:0)
更改日志3.2.0 https://pub.dev/packages/provider#320
已过时的提供商“构建者”赞成“创建”
您可以使用create
代替builder
https://pub.dev/packages/provider#proxyprovider中的示例
代码段
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => Counter()),
ProxyProvider<Counter, Translations>(
create: (_, counter, __) => Translations(counter.value),
),
],
child: Foo(),
);
}