Bloc: flutter_bloc doesn't recognize the named parameter builder

Created on 16 Jan 2020  路  2Comments  路  Source: felangel/bloc

Hi,

Two month ago I've started a flutter project. Unfortunatly I had to let it to work on professionnal stuff. back on my flutter project, I'm upgrading dependencies, passing bloc et flutter_bloc from 2.0 to 3.0, and SURPRISE ! When I try to run my project, It says that builder isn't defined here (and in other place, I use bloc A LOT) :

`
Future main() async {
await di.init();
BlocSupervisor.delegate = SimpleBlocDelegate();
runApp(BlocProvider(
builder: (BuildContext context) {
return di.serviceLocator()..add(AppStarted());
},
child: const BlueKanGoApp(),
));
}

`

What happened? I can find in documentation that actually I've to use BlocBuilder instead of BlocProvider and use 'create' instead of 'builder'. Is it normal?

Thanks for your answer and all your work for Flutter community

question

All 2 comments

Hi @Kobreizhyashi, the syntax changed a little, now you should pass a create function and not a builder.

Here's the doc: https://bloclibrary.dev/#/flutterbloccoreconcepts?id=blocprovider

I just saw that by downgrading my flutter_bloc version. got to handle this ! thanks for your (QUICK!) answer and sorry for the useless ticket.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clicksocial picture clicksocial  路  3Comments

ricktotec picture ricktotec  路  3Comments

nhwilly picture nhwilly  路  3Comments

rsnider19 picture rsnider19  路  3Comments

komapeb picture komapeb  路  3Comments