title: ERROR:flutter/lib/ui/ui_dart_state.cc(157) Unhandled Exception: type 'Future<dynamic>' is not a subtype of type 'FutureOr<Null>
body: <p>I'm trying handle  error from http request in showDialog and then throw an error but i'm facing this bug</p>
  
  <p><strong>Error</strong></p>
  
  <blockquote>
    <p>E/flutter (18769): #13     TextInput._handleTextInputInvocation 
       package:flutter/…/services/text_input.dart:968 E/flutter (18769): #14
       MethodChannel._handleAsMethodCall 
       package:flutter/…/services/platform_channel.dart:402 E/flutter
       (18769): #15     MethodChannel.setMethodCallHandler.  package:flutter/…/services/platform_channel.dart:370
       E/flutter (18769): #16<br>
       _DefaultBinaryMessenger.handlePlatformMessage  package:flutter/…/services/binding.dart:200 E/flutter (18769): #17<br>
       _invoke3.  (dart:ui/hooks.dart:303:15) E/flutter (18769): #18     _rootRun  (dart:async/zone.dart:1126:13) E/flutter
       (18769): #19     _CustomZone.run  (dart:async/zone.dart:1023:19)
       E/flutter (18769): #20     _CustomZone.runGuarded 
       (dart:async/zone.dart:925:7) E/flutter (18769): #21     _invoke3 
       (dart:ui/hooks.dart:302:10) E/flutter (18769): #22<br>
       _dispatchPlatformMessage  (dart:ui/hooks.dart:162:5)</p>
  </blockquote>
  
  <pre><code>
    Future&lt;void&gt; addProduct(Product product) {
      const url = 'https://flutter-shop-768a7.firebaseio.com/products.jon';
      return http
          .post(url,
              body: json.encode({
                'title': product.title,
                'description': product.description,
                'imageUrl': product.imageUrl,
                'price': product.price,
                'isFavorite': product.isFavorite
              }))
          .then((response) {
        final newProduct = Product(
            title: product.title,
            description: product.description,
            imageUrl: product.imageUrl,
            price: product.price,
            id: json.decode(response.body)['name']);
        // _items.insert(index, element)
        _items.add(newProduct);
        notifyListeners();
      }).catchError((error) {
        throw error;
      });
    }
  
  </code></pre>
  
  <pre><code>     Provider.of&lt;Products&gt;(context, listen: false)
            .addProduct(_edditedProduct)
            .catchError((error) {
          return showDialog(
            context: context,
            builder: (ctx) =&gt; AlertDialog(
              title: Text('An Error occurred!'),
              content: Text('Someghing went wrong'),
              actions: &lt;Widget&gt;[
                FlatButton(
                    child: Text('ok'),
                    onPressed: () async =&gt; Navigator.of(context).pop())
              ],
            ),
          );
        }).then((_) {
          print('this is then function');
          setState(() {
            _isLoading = false;
          });
          Navigator.pop(context);
        });
  
  </code></pre>