// PAGE
class MyPage extends StatelessWidget {
const MyPage({super.key});
static String path = 'my';
@override
Widget build(BuildContext context) {
return Scaffold(
// Inject Bloc(s)
body: BlocProvider(
create: (context) => MyBloc(dependency: context.read<Dependency>()),
// VIEW
// MyView, and all its nested child Widgets, will have access to MyBloc
child: const MyView(),
),
);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter