title: Exception type null thrown from state for cubit
body: <p>In the process of learning bloc and have started to create a basic state and cubit but I am now getting the following error.</p>
  <p>I should be seeing a grey screen in emulation mode instead, I see the following red error.</p>
  <p>_TypeError (type 'Null' is not a subtype of type 'Color' of 'function result')</p>
  <p>I'm not quite sure why, since the first state should be Color.grey?</p>
  <p>Main.dart</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_bloc/flutter_bloc.dart';
  import 'package:bloctest/cubit/color_cubit.dart';
  
  void main() {
    runApp(const MyApp());
  }
  
  class MyApp extends StatelessWidget {
    const MyApp({Key? key}) : super(key: key);
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: BlocProvider(
          create: (context) =&gt; ColorCubit(),
          child: BlocBuilder&lt;ColorCubit, ColorState&gt;(builder: (context, state) {
            return Container(
                color: state.color,
                child: FloatingActionButton(
                  onPressed: () {
                    print('we will change the state soon');
                  },
                ));
          }),
        ),
      );
    }
  }
  </code></pre>
  <p>color_state.dart</p>
  <pre><code>part of 'color_cubit.dart';
  
  abstract class ColorState extends Equatable {
    final Color color;
    const ColorState(this.color);
  
    @override
    List&lt;Object&gt; get props =&gt; [];
  }
  
  class ColorInitial extends ColorState {
    const ColorInitial() : super(Colors.grey);
  }
  
  </code></pre>
  <p>color_cubit.dart</p>
  <pre><code>import 'package:bloc/bloc.dart';
  import 'package:equatable/equatable.dart';
  import 'package:flutter/material.dart';
  
  part 'color_state.dart';
  
  class ColorCubit extends Cubit&lt;ColorState&gt; {
    ColorCubit() : super(const ColorInitial());
  }
  </code></pre>