VERBOSE-2:ui_dart_state. cc(199) Unhandled Exception: type 'Future<Map<String? , Dynamic>? >'

Asked

Viewed 28 times

-1

[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: type 'Future<Map<String?, dynamic>?>' is not a subtype of type 'FutureOr<Map<String?, dynamic>>' in type cast
#0      MercadoPagoMobileCheckout1.startCheckout (package:vexa_calendario/controller/mercado_pago.dart:29:7)
#1      _PremiumScreenState.getMercadoPago.<anonymous closure> (package:vexa_calendario/screens/premium.dart:66:66)
#2      _PremiumScreenState.getMercadoPago.<anonymous closure> (package:vexa_calendario/screens/premium.dart:64:23)
#3      _rootRunUnary (dart:async/zone.dart:1362:47)
#4      _CustomZone.runUnary (dart:async/zone.dart:1265:19)
<asynchronous suspension> 

Code:

Future<void> getMercadoPago() async {
    // ignore: unnecessary_null_comparison
    if (getToekn() != null) {
      getToekn().then((result) async {
        dynamic id = result['response']['id'];
        PaymentResult result1 = await MercadoPagoMobileCheckout.startCheckout(
          publicKey,
          id,
        );
        print(result1.toString());
        print(id);
      });
    }
 }
  • Detail the problem, try to put the snippet a code snippet that is easy to play/test.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.