flutter_card_io icon indicating copy to clipboard operation
flutter_card_io copied to clipboard

Reloading automatically many times using FutureBuilder

Open crcaicedo opened this issue 5 years ago • 1 comments

I am using a FutureBuilder with the scan card method, but when I finish the scan, the scan card screen shows again, I accept the new scan, but scan card screen shows again, the cycle never finishes until I cancel the scan. This is a snippet of my code:

  Future<bool> _scanCard() async {
    bool ok = false;
    Map<String, dynamic> result = await FlutterCardIo.scanCard({
      "requireExpiry": true,
      "scanExpiry": true,
      "requireCVV": false,
      "requirePostalCode": false,
      "restrictPostalCodeToNumericOnly": false,
      "requireCardHolderName": false,
      "scanInstructions": R.s("scanCardTitle")
    });
   ok = true;
}

 @override
 Widget build(BuildContext context) {
      return FutureBuilder(future: _scanCard(),
          builder: (BuildContext context, AsyncSnapshot snapshot) {
            if (snapshot.hasData) {
              return _customBuilder(context);
            }
            else return CircularProgressIndicator();
          });
 }

I will be very thankful if anyone shares an idea or solution. Best regards.

crcaicedo avatar Jun 18 '19 19:06 crcaicedo

@crcaicedo Will test and fix this, It's probably too late for you but might help others

procedurallygenerated avatar Nov 24 '19 11:11 procedurallygenerated