BLoC Navigation with Flutter | Day 15
HTML-код
- Опубликовано: 8 сен 2024
- Kilo Loco shows you how to navigate between screens using Flutter BLoC and the Navigator 2.0. This tutorial will cover creating a navigation cubit, implementing a MultiBlocProvider, and utilizing the cubit's state to determine when to show a post details screen.
** Show Notes and Links **
Project Files:
github.com/Kil...
Kilo Loco on Social Media:
www.kiloloco.com
Discord - / discord
Twitter - / kilo_loco
Instagram - / kilo_loco
#flutter #dartlang #30DaysOfFlutter
Yeahhh bro, this series are killing me!!! lmL KILO LOCOUUU
Hello i'm havibg an error while using AppNavigator() in main.dart file
Child: AppNavigator(),
It shows 1positional argument(s) expected but 0 found
Bloc series is 🔥
#thankyou #flutter #happycoding
#sharemoretutorial
Thanks! It seems to be the more popular pattern at the moment so almost everything from here on out will be using BLoC
@@Kilo_Loco yes it is!
And thank you so much❤️
Good!
And Thank's for English class for me "a 'Ffff__n ' like that so easy peasy - lemon squeezy " , will on Monday I will use it on meting, expats will have a shock )))
Thanks for this amazing series Kilo...simply amazing.
Kilo thanks brother
kilo
do you have a video for the new version of the bloc (version 8)? You explained it as easy to understand...
thank you
you rock my dude!
2023 and I am referring his videos over and over again to learn basics 🤌🤌
Thanks a lot! this helps me quickly able to use cubit&block, 10x more productive than reading api docs. feel that cubit&bloc somehow similar to observerable in swifuit, isn't it?
There are definitely a lot of similarities. I’ll be doing a bloc pattern tutorial in swift sometime after the challenge
@@Kilo_Loco can we use onTap: () => Navigator.puh(goto PostDetailView()) ? for each Card? pages inside Navigator can access the Cubit, many thanks your video ( I was struggling this).
@@Kilo_Loco I feel like Swift enums with the associated value could really shine there :)
you should start using bloc extension or flutter snippets
Hello everyone I am learning flutter and new this sphere. I have an error. class NavCubit extends Cubit {
NavCubit() : super(null); this ''null'' is making eror
void showPostDetails(Post post) => emit(post);
void popToPosts() => emit(null);
}
how can I fix it? could you help me? please.
I think you should change NavCubit extends Cubit to NavCubit extends Cubit
Hi, If we put Cubit
then the following code gives an error
class AppNavigator extends StatelessWidget {
const AppNavigator({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlocBuilder( //this
@@Praveenmgupta there's that line that has . Change that to to indicate that the post can be null
Hey Pressing back button exits the app, can you tell what it could possibly be?
how do we add a drawer menu and login screen with this example?
How can we do parallel api calls in flutter bloc ?
how to use two bloc and manage one single state
I prefer Getx in navigation
Hi, I am getting an error, please help-
class AppNavigator extends StatelessWidget {
const AppNavigator({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlocBuilder( //this
With Bloc v8.0.0. mapEventToState is deprecated so, here You go, i did it ...
class PostsBloc extends Bloc {
final _dataService = DataService();
PostsBloc() : super(LoadingPostsState()) {
on((event, emit) async {
await _getPost(emit);
});
}
Future _getPost(Emitter emit) async {
emit(LoadingPostsState());
try {
final posts = await _dataService.getPosts();
emit(LoadedPostsState(posts: posts));
} on Error catch (e) {
emit(FailedToLoadPostsState(error: e));
}
}
}