Skip to content

Reloading automatically many times using FutureBuilder #8

@crcaicedo

Description

@crcaicedo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions