From 01d4ce2dff1e8746e8348661415ddf5f93caf287 Mon Sep 17 00:00:00 2001 From: Igor Kravchenko Date: Sat, 15 Aug 2020 14:20:05 +0300 Subject: [PATCH] feat: support v.6 bloc --- templates/mutable/bloc.tmpl | 1 + templates/mutable/screen.tmpl | 2 +- templates/simple/screen.tmpl | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/mutable/bloc.tmpl b/templates/mutable/bloc.tmpl index 52e1ae7..7ae35ab 100644 --- a/templates/mutable/bloc.tmpl +++ b/templates/mutable/bloc.tmpl @@ -6,6 +6,7 @@ import 'package:${appName}${relative}/index.dart'; class ${upperName}Bloc extends Bloc<${upperName}Event, ${upperName}State> { // todo: check singleton for logic in project + // use GetIt for DI in projct static final ${upperName}Bloc _${privateName}BlocSingleton = ${upperName}Bloc._internal(); factory ${upperName}Bloc() { return _${privateName}BlocSingleton; diff --git a/templates/mutable/screen.tmpl b/templates/mutable/screen.tmpl index 3c87ae9..c9e4301 100644 --- a/templates/mutable/screen.tmpl +++ b/templates/mutable/screen.tmpl @@ -34,7 +34,7 @@ class ${upperName}ScreenState extends State<${upperName}Screen> { @override Widget build(BuildContext context) { return BlocBuilder<${upperName}Bloc, ${upperName}State>( - bloc: widget._${privateName}Bloc, + cubit: widget._${privateName}Bloc, builder: ( BuildContext context, ${upperName}State currentState, diff --git a/templates/simple/screen.tmpl b/templates/simple/screen.tmpl index 8c86fef..5e7cc63 100644 --- a/templates/simple/screen.tmpl +++ b/templates/simple/screen.tmpl @@ -34,7 +34,7 @@ class ${upperName}ScreenState extends State<${upperName}Screen> { @override Widget build(BuildContext context) { return BlocBuilder<${upperName}Bloc, ${upperName}State>( - bloc: widget._${privateName}Bloc, + cubit: widget._${privateName}Bloc, builder: ( BuildContext context, ${upperName}State currentState,