Reputation: 2298
When trying to use ProxyProvider using the example syntax given in https://pub.dev/packages/provider
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => Counter()),
ProxyProvider<Counter, Translations>(
create: (_, counter, __) => Translations(counter.value),
),
],
child: Foo(),
);
}
class Translations {
const Translations(this._value);
final int _value;
String get title => 'You clicked $_value times';
}
I end up having following error in create function every time:
The argument type 'Translation Function(BuildContext, dynamic, dynamic)' can't be assigned to the parameter type 'Translation Function(BuildContext)'.dart(argument_type_not_assignable)
what I am doing wrong?
Upvotes: 0
Views: 352
Reputation: 26
The documentation haven't updated yet.
In v3.2.0 you should use create
with one argument - BuildContext.
You can downgrade to 3.1.0 and continue using builder
with 3 arguments.
old:
builder: (context, x, y) => ...
new
create: (context) => ...
Upvotes: 1