title: Flutter json.decode issue <!doctype html> error
body: <p>I am trying to integrate stripe payment in my Flutter project with backend Laravel. For some reason I am getting error at json.decode.</p>
  <blockquote>
  <p>E/flutter (10999): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)]
  Unhandled Exception: FormatException: Unexpected character (at
  character 1) E/flutter (10999): &lt;!doctype html&gt;</p>
  </blockquote>
  <pre><code>FlatButton(
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(7.0)),
                      color: Colors.redAccent,
                      onPressed: () {
                        var payment = Payment();
                        payment.name = _cardHolderName.text;
                        payment.email = _cardHolderEmail.text;
                        payment.cardNumber = _cardNumber.text;
                        payment.expiryMonth = _expiryMonth.text;
                        payment.expiryYear = _expiryYear.text;
                        payment.cvcNumber = _cvcNumber.text;
  
                        _makePayment(context, payment);
                        
                      },
                      child: Text('Make Payment',
                          style: TextStyle(color: Colors.white)),
                    ),
  </code></pre>
  <pre><code>void _makePayment(BuildContext context, Payment payment) async {
      PaymentService _paymentService = PaymentService();
      var paymentData = await _paymentService.makePayment(payment);
      var result = json.decode(paymentData.body);
  
      if (result['result'] == true) {
        CartService _cartService = CartService();
        this.widget.cartItems.forEach((cartItem){
          _cartService.deleteCartItemById(cartItem.productId);
        });
        _showPaymentSuccessMessage(context);
        Timer(Duration(seconds: 2), () {
          Navigator.pop(context);
          Navigator.push(
              context, MaterialPageRoute(builder: (context) =&gt; HomeScreen()));
        });
      }
    }
  </code></pre>
  <p>Payment Service</p>
  <pre><code>class PaymentService {
    Repository _repository;
  
    PaymentService(){
      _repository = Repository();
    }
  
    makePayment(Payment payment) async {
      return await _repository.httpPost('make-payment', payment.toJson());
    }
  }
  </code></pre>
  <p>Laravel Code</p>
  <pre><code>public function makePayment(Request $request)
      {
          \Stripe\Stripe::setApiKey('sk_test_7422pw1lMsdRfN2FaPmfFKlt00AtiIJD9O');
          
          $token = Token::create([
              'card'=&gt;[
                  'number'=&gt;$request-input('cardNumber'),
                  'exp_month'=&gt;$request-input('expiryMonth'),
                  'exp_year'=&gt;$request-input('expiryYear'),
                  'cvc'=&gt;$request-input('cvcNumber')
                  ]
              
              ]);
  
  \Stripe\PaymentIntent::create([
    'amount' =&gt; 1000,
    'currency' =&gt; 'inr',
    'source'  =&gt; $token,
    'receipt_email' =&gt; $request-&gt;input('email'),
  ]);
      }
  </code></pre>
  <p>Error</p>
  <pre><code>E/flutter (10999): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FormatException: Unexpected character (at character 1)
  E/flutter (10999): &lt;!doctype html&gt;
  E/flutter (10999): ^
  E/flutter (10999): 
  E/flutter (10999): #0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1394:5)
  E/flutter (10999): #1      _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1261:9)
  E/flutter (10999): #2      _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:926:22)
  E/flutter (10999): #3      _parseJson (dart:convert-patch/convert_patch.dart:31:10)
  E/flutter (10999): #4      JsonDecoder.convert (dart:convert/json.dart:495:36)
  E/flutter (10999): #5      JsonCodec.decode (dart:convert/json.dart:153:41)
  E/flutter (10999): #6      _PaymentScreenState._makePayment (package:factory2homes/screens/payment_screen.dart:160:23)
  E/flutter (10999): &lt;asynchronous suspension&gt;
  E/flutter (10999): #7      _PaymentScreenState.build.&lt;anonymous closure&gt; (package:factory2homes/screens/payment_screen.dart:142:23)
  E/flutter (10999): #8      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
  E/flutter (10999): #9      _InkResponseState.build.&lt;anonymous closure&gt; (package:flutter/src/material/ink_well.dart:789:36)
  E/flutter (10999): #10     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
  E/flutter (10999): #11     TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
  E/flutter (10999): #12     BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:264:5)
  E/flutter (10999): #13     BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:236:7)
  E/flutter (10999): #14     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
  E/flutter (10999): #15     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20)
  E/flutter (10999): #16     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
  E/flutter (10999): #17     GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
  E/flutter (10999): #18     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
  E/flutter (10999): #19     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
  E/flutter (10999): #20     _rootRunUnary (dart:async/zone.dart:1138:13)
  E/flutter (10999): #21     _CustomZone.runUnary (dart:async/zone.dart:1031:19)
  E/flutter (10999): #22     _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
  E/flutter (10999): #23     _invoke1 (dart:ui/hooks.dart:273:10)
  E/flutter (10999): #24     _dispatchPointerDataPacket (dart:ui/hooks.dart:182:5)
  E/flutter (10999): 
  </code></pre>