countDown static method

Future<Map<String, dynamic>> countDown(
  1. int initTime,
  2. int timeout,
  3. String key
)

Implementation

static Future<Map<String, dynamic>> countDown(int initTime, int timeout, String key) async {
  int ntimeout = timeout - initTime;
  Map<String, dynamic> defaultvalue = Map<String, dynamic>.from({"code": 0, "desc": "", "data": "", "json_param": ""});
  if (ntimeout <= 0) {
    print("the method $key has timeout check the catchNativeData");
    return defaultvalue;
  }
  await Future.delayed(Duration(milliseconds: initTime));
  if (catchNativeData.containsKey(key)) {
    Map<String, dynamic> res = Map<String, dynamic>.from(catchNativeData.remove(key)!);

    return res;
  }
  return countDown(initTime, ntimeout, key);
}