jacobaraujo7 / bloc-pattern

Apenas um package com bases para implantar o Bloc no seu Código
MIT License
134 stars 20 forks source link

ModuleWidget's bloc is not singleton #21

Closed imelos closed 5 years ago

imelos commented 5 years ago

V2.3.3

class HomeModule extends ModuleWidget {
  @override
  List<Bloc<BlocBase>> get blocs => [
        Bloc((i) => HomeBloc(), singleton: true)
      ];

  @override
  List<Dependency> get dependencies => [];

  @override
  Widget get view => HomeWidget();

  static Inject get to => Inject<HomeModule>.of();

}

And then

final HomeBloc bloc = HomeModule.to.bloc<HomeBloc>();

Every time after rebuilding HomeWidget my bloc variable has new HomeBloc instance(not singleton). Is that expected behavior?

jacobaraujo7 commented 5 years ago

It´s is a bug! i'm fix it

jacobaraujo7 commented 5 years ago

what version bloc_pattern?

imelos commented 5 years ago

Thanks!