title: type Null is not a subtype of type 'MyColor' Inherited Widget (Flutter)
body: <p><strong>I used Inherited Widget and when I use it it tells me that there is a problem with context even though it has its own builder</strong></p>
  <blockquote>
  <p>Is it mandatory to have a key in the super ?</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/LTGk0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LTGk0.png" alt="enter image description here" /></a></p>
  <pre><code>class MyColor extends InheritedWidget{
     Key? key ;
    final Color color ;
    final Widget child ;
    MyColor({required this.color , required this.child}) : super(child: child) ;
  
    @override
    bool updateShouldNotify(covariant MyColor oldWidget) {
     return color != oldWidget.color ;
    }
  static MyColor of(context)=&gt;
      context.dependOnInheritedWidgetOfExactType&lt;MyColor&gt;();
  }
  </code></pre>
  <pre><code> Builder(builder: (ctx) {
            return MyColor(
              color: Colors.teal,
              child:  Text(
                'Text Color Inherited',
                style: TextStyle(color: MyColor?.of(ctx).color),
              ),
            );
          }),
  </code></pre>