Flutter ChangeNotifierProvider builder is deprecated

Instead of builder parameter you can use create param with Product() or specific product at Index.

itemBuilder: (ctx, i) => ChangeNotifierProvider(
        create: (context) => products[i],
        child:  ProductItem(),
      ), 

Or can be use as Value version:

itemBuilder: (ctx, i) => ChangeNotifierProvider.value(
        value: products[i],
        child:  ProductItem(),
      ),

you can use "create" instead of "builder"

main() {
 runApp(
   MultiProvider(
     providers: [
       ChangeNotifierProvider(create: (context) => Auth()), // /**problem here. 
builder displayed with strikethrough line**/
     ],
     child: App(),
   ),
 );

}


you can pass with create as builder.

    return Provider<MyProvider>(
        create: (context) => MyProvider(

        ),
        child: HomePage(),
    );

Since provider version 3.2.0 "builder" is marked as deprecated in favor of "create".

More info can be found in the change log

So should do:

ChangeNotifierProvider(create: (context) => Auth())

Tags:

Dart

Flutter