'How to Store Http json data into variables and calculate with firestore data Flutter
How to take http json data and store in variables and in the same page read firestore data and calculate with reference to http json data and display
Example: Json Data : a=1,b=2,c=3 Firestore Data : d=4,e=5,f=6
How to do sum= a*d ? in Flutter
Solution 1:[1]
Just wait for the async requests to complete before you do the calculation.
You can use Future.wait() to wait for the two async requests to be called and ended.
Example:
Future.wait([ getDataFromAPI(),getDataFromFirebase()]);
You can set the result from api and firebase to their respective variables and once the future is completed, you can perform the operation you wanted.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | suzan |
