Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type 'ChangeNotifierProxyProvider' is declared with 2 type parameters, but 3 type arguments were given

Tags:

flutter

dart

I use a provider inside of another provider using that declaration

 ChangeNotifierProxyProvider<Auth, Sali>(
            update: (ctx, auth, prevData) => Sali(
                auth.token, auth.userId, prevData == null ? [] : prevData.sali),
          ),

but I need to use 2 providers inside another so I tried:

ChangeNotifierProxyProvider<Auth,Mese, Sali>(
            update: (ctx, auth,mes, prevData) => Sali(
                auth.token, auth.userId, prevData == null ? [] : prevData.sali),

but got this error:

"The type 'ChangeNotifierProxyProvider' is declared with 2 type parameters, but 3 type arguments were given.

thanks

like image 280
mrapi Avatar asked Sep 20 '25 11:09

mrapi


1 Answers

mrapi, I haven't used ChangeNotifierProxyProvider but have you tried ChangeNotifierProxyProvider2. Looking at the documentation, i think it takes 3 parameters.

like image 167
Pro Avatar answered Sep 22 '25 07:09

Pro