Given a ProxyProvider like the following,
MultiProvider( providers: [ ChangeNotifierProvider<MyModel>( builder: (context) => MyModel(), ), ProxyProvider<MyModel, AnotherModel>( builder: (context, myModel, anotherModel) => AnotherModel(myModel), ), ],
what is the third input parameter (
anotherModel) in the builder function? The documentation doesn’t explain it. If it is the same type as the returned function, why is it an input parameter?
If you have a ProxyProvider like this:
ProxyProvider<MyModel, AnotherModel>( builder: (context, myModel, anotherModel) => AnotherModel(myModel), )
As was mentioned in the comments and the docs, these are the parameter values:
context: This is the
myModel: This is a value that you are passing into the ProxiProvider to use as an input for the value that the builder returns.
anotherModel: This is the last built value of the builder. The first time this value is
Answered By – Suragch
Answer Checked By – Marie Seifert (FlutterFixes Admin)