DART - how to combine two different Future based queries?

user2868835

I have a Flutter form that will require data from two different sources, i.e.

class DataForForm {
   MasterData master;
   List<Transaction> transactions;
}

One query will bring back 'master data', and a second query will bring back 'transaction data'.

How can I build a 'Future' call that will wait for both queries to execute, and for the results to be returned in the aggregated 'DataForForm' class?

TripleNine

Try something like this:

Future<DataForForm> getData(...) async {
  MasterData masterData = await getMasterData(...);
  List<Transaction> transactions = await getTransactions(...);
  return DataForm(master: masterData, transactions: transactions);
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how to combine two different queries?

How to combine the results of two different queries with mongoose?

How to combine traditional and Future-based API in one interface in Dart?

combine two different queries into one

how to combine these two queries

How to combine two update queries having different set and where clause?

How to combine two SQL queries with different where conditions?

How do I combine these two different LINQ queries into one?

How to combine the results of two different queries into a single query in SQL

how to combine results of two different queries from one table mysql

EF6: How to combine two different count() queries into one?

How to combine two queries? MySQL

Postgresql - how to combine these two queries

Postgresql how to combine these two queries?

How to combine these two credentials Queries?

How to combine two queries in Splunk?

How to combine the results of two queries?

How to correctly combine these two queries?

Combine two SELECT queries with different function

Combine two queries into one with IN different condition

How to combine two lists with different properties based on a condition in C#

SQL Server : how to combine multiple rows based on two different columns?

How to combine two array of objects of different sizes, based on a property in Javascript?

How to combine two pandas dataframes with different length based on their row values

SQL/Hive How to combine two different queries into one result with different columns

How to combine aggregated queries with different joins?

How to combine two BigQuery queries where I've used different fields to group by?

How to combine two SQL queries in MySQL with different columns without combining their resulting rows

(MySQL 5.7) How to combine my two queries?