flutter bloc should be singleton if it don't listen to anything?

Viewed 202

I'm using flutter_bloc and get_it plugins and I saw that everyone declare bloc as factory because in bloc you usually listen to stuff and as factory you can use the close method. the question is, if you don't listen to anything and don't use the bloc close() method is it still better to declare it as factory and not singleton?

this is my declaration for now :

  static provideModules() {
    getIt.registerFactory(() => DeviceDataCubit());
    getIt.registerFactory(() => PermissionsCubit());
    getIt.registerFactory(() => LocationBloc(permissionsCubit: getIt.get(), dataRecordRepository: getIt.get()));
  }
}

0 Answers
Related