flutterdartflutter-card

Card widget gives error when I use fluter_stripe payment method in same page


I am using flutter_stripe lib for integrating the Stripe payment method but it gives an error when I use Card widget with this lib.

My error is given as:

"The name 'Card' is defined in the libraries 'package:flutter/src/material/card.dart (via package:flutter/material.dart)' and 'package:stripe_platform_interface/src/models/payment_methods.dart'.\nTry using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.",


Solution

  • I found its answer by modifying the flutter_stripe import as import 'package:flutter_stripe/flutter_stripe.dart' hide Card;

    Because Card(flutter widget) creates conflict with the Card class of flutter_stripe.