Starting out with bloc but having problems following. Why does this code
agapa_screen.dart
class AgapeScreen extends StatefulWidget {
@override
_AgapeState createState() => _AgapeState();
}
class _AgapeState extends State<AgapeScreen> {
@override
Widget build(BuildContext context) {
return BlocBuilder<AgapeBloc, Agape>(
builder: (context, agape) {
return Container();
}
);
}
}
say Error: Type argument 'AgapeBloc' doesn't conform to the bound 'Bloc
The following are my code.
agape.dart
class Agape {
String id;
Agape();
}
and
agape_bloc.dart
class AgapeBloc extends Bloc<AgapeEvent, Agape> {
@override
Agape get initialState => Agape();
@override
Stream<Agape> mapEventToState(AgapeEvent event) async* {
switch (event) {
case AgapeEvent.get:
break;
case AgapeEvent.put:
break;
}
}
}
enum AgapeEvent { get, put }
Hi @chitgoks 馃憢
Thanks for opening an issue!
Are you able to provide a link to a sample app which illustrates the issue? It would be much easier for me to help if I can reproduce the issue locally, thanks! 馃憤
hi felix thank you for reaching out. ill try, i havent tried putting this up remotely. it's a compile issue. you can copy the same code in dart files.
i added the widget class and edited the Agape class to remove the interface. so these can be copied and pasted manually as well.
This was my mistake. im closing this. this was due to my naming of the screen and model having the same names.
Most helpful comment
This was my mistake. im closing this. this was due to my naming of the screen and model having the same names.