title: Triggering initial event in BLoC
body: <p>example_states:</p>
  <pre><code>abstract class ExampleState extends Equatable {
    const ExampleState();
  }
  
  class LoadingState extends ExampleState {
    //
  }
  
  class LoadedState extends ExampleState {
    //
  }
  
  class FailedState extends ExampleState {
    //
  }
  </code></pre>
  <p>example_events:</p>
  <pre><code>abstract class ExampleEvent extends Equatable {
    //
  }
  
  class SubscribeEvent extends ExampleEvent {
    //
  }
  
  class UnsubscribeEvent extends ExampleEvent {
    //
  }
  
  class FetchEvent extends ExampleEvent {
    // 
  }
  </code></pre>
  <p>example_bloc:</p>
  <pre><code>class ExampleBloc extends Bloc&lt;ExampleEvent, ExampleState&gt; {
    @override
    ExampleState get initialState =&gt; LoadingState();
  
    @override
    Stream&lt;ExampleState&gt; mapEventToState(
      ExampleEvent event,
    ) async* {
      if (event is SubscribeEvent) {
        //
      } else if (event is UnsubscribeEvent) {
        //
      } else if (event is FetchEvent) {
        yield LoadingState();
        try {
          // network calls
          yield LoadedState();
        } catch (_) {
          yield FailedState();
        }
      }
    }
  }
  </code></pre>
  <p>example_screen:</p>
  <pre><code>class ExampleScreenState extends StatelessWidget {
    // ignore: close_sinks
    final blocA = ExampleBloc();
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: BlocBuilder&lt;ExampleBloc, ExampleState&gt;(
          bloc: blocA,
          // ignore: missing_return
          builder: (BuildContext context, state) {
            if (state is LoadingState) {
              blocA.add(Fetch());
              return CircularProgressBar();
            }
  
            if (state is LoadedState) {
              //...
            }
  
            if (state is FailedState) {
              //...
            }
          },
        ),
      );
    }
  }
  </code></pre>
  <p>As you can see in example_bloc, initial state is LoadingState() and in build it shows circular progress bar. I use Fetch() event to trigger next states. But I don't feel comfortable using it there. What I want to do is:</p>
  <p>When app starts, it should show LoadingState and start networking calls, then when it's all completed, it should show LoadedState with networking call results and FailedState if something goes wrong. I want to achieve these without doing</p>
  <pre><code>if (state is LoadingState) {
    blocA.add(Fetch());
    return CircularProgressBar();
  }
  </code></pre>