getAsyncData static method
Implementation
static Future<Map<String, dynamic>> getAsyncData({
required String apiKey,
int? maxtimeout,
}) async {
// int initTime =
// 30; // the init delay time is 30, and the total timeout time is 1000ms
// int timeout = maxtimeout ?? 3000;
// return await countDown(initTime, timeout, apiKey);
await for (Map<String, Map<String, dynamic>> value in controller.stream) {
if (value.containsKey(apiKey)) {
var data = value[apiKey] ?? Map<String, dynamic>.from({});
value.remove(apiKey);
return data;
}
}
return Map<String, dynamic>.from({});
}