title: Flutter: Widget is not a subtype of type 'ObstructingPreferredSizeWidget'
body: <p>I am trying to store my AppBar in a variable for using multiple places</p>
  
  <p>My main.dart file contains -</p>
  
  <pre><code>final PreferredSizeWidget appBar = NavigationAppBar(_actionCall)
  </code></pre>
  
  <p>And navigation_app_bar contains -</p>
  
  <pre><code>class NavigationAppBar extends StatelessWidget with PreferredSizeWidget {
    final Function actionCall;
  
    NavigationAppBar(this.actionCall);
  
    @override
    Widget build(BuildContext context) {
      return Platform.isIOS ? 
      CupertinoNavigationBar(
        middle: Text(
          'ABC'
        ),
        trailing: Row(
          mainAxisSize: MainAxisSize.min,
          children: &lt;Widget&gt;[
              GestureDetector(
                child: Icon(CupertinoIcons.add),
                onTap: () =&gt; actionCall,
              )
          ],
        ),
      ) : 
      AppBar(
        title: Text('ABC'),
        centerTitle: false,
        actions: &lt;Widget&gt;[
          IconButton(
            icon: Icon(Icons.add),
            onPressed: () =&gt; actionCall,
          )
        ],
      );
    }
  
    @override
    Size get preferredSize =&gt; Size.fromHeight(kToolbarHeight);
  }
  </code></pre>
  
  <p>But when trying to run my flutter app getting following error.</p>
  
  <pre><code>type 'NavigationAppBar' is not a subtype of type 'ObstructingPreferredSizeWidget'
  </code></pre>
  
  <p>How can i solve this issue? Any kind help is appreciated.</p>