title: Using flutter_bloc with tabview
body: <p>I have a tabview where I have popular, recent and upcoming categories. They all have same response on the api. I am trying to fetch data from api using flutter_bloc. Previously I was using rxdart subject and I made a subject for each type of data. Now using flutter bloc I want to achieve the same. What I want to do is to switch between the tabs. Previously I used behaviorsubject to hold the data until next event but now I want to transition to bloc pattern. How do I achieve same type of result using flutter_bloc? Or I need to create bloc for each type? And finally how can I fetch data from api such that when tab is switched, state is persisted? My Rxdart implementation:</p>
  <pre><code>class DataBloc {
    final DataRepo _repository = DataRepo();
    final BehaviorSubject&lt;Data&gt; _recent = BehaviorSubject&lt;Data&gt;();
    final BehaviorSubject&lt;Data&gt; _popular = BehaviorSubject&lt;Data&gt;();
    final BehaviorSubject&lt;Data&gt; _upcoming = BehaviorSubject&lt;Data&gt;();
    
  getData(String type) async {
      
      Data response = await _repository.getData(type);
      if (type == &quot;recent&quot;) {
        _recent.sink.add(response);
      } else if (type == &quot;upcoming&quot;) {
        _upcoming.sink.add(response);
      } else {
        _popular.sink.add(response);
      }
    }
  
    dispose() {
      _recent?.close();
      _popular?.close();
      _upcoming?.close();
    }
  
    BehaviorSubject&lt;Data&gt; get recent =&gt; _recent;
    BehaviorSubject&lt;Data&gt; get popular =&gt; _popular;
    BehaviorSubject&lt;Data&gt; get upcoming =&gt; _upcoming;
  }
  </code></pre>