-
-
Save TechieBlossom/376a886e6ecb33f23b9d943f9acced25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _HomeScreenState extends State<HomeScreen> { | |
MovieCarouselBloc movieCarouselBloc; | |
MovieBackdropBloc movieBackdropBloc; | |
@override | |
void initState() { | |
super.initState(); | |
movieCarouselBloc = getItInstance<MovieCarouselBloc>(); | |
//1 | |
movieBackdropBloc = getItInstance<movieBackdropBloc>(); | |
movieCarouselBloc.add(CarouselLoadEvent()); | |
} | |
@override | |
void dispose() { | |
super.dispose(); | |
//2 | |
movieCarouselBloc?.close(); | |
movieBackdropBloc?.close(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return MultiBlocProvider( | |
providers: [ | |
//3 | |
BlocProvider(create: (_) => movieCarouselBloc), | |
BlocProvider(create: (_) => movieBackdropBloc), | |
], | |
child: Scaffold(), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment