getRequestData static method

Future<Map> getRequestData(
  1. int? id
)

Implementation

static Future<Map> getRequestData(int? id) async {
  Map data = {};
  Execute? execute;
  if (id != null) {
    execute = Execute.cache(id);
    await execute.init();
  }

  for (var arg in requestArgument) {
    if (arg.startsWith('--args=')) {
      // --args=name=value
      final values = arg.substring(7).split('=');
      data[values[0]] = values[1];
    } else if (arg.startsWith('--env=') && execute != null) {
      // --env=name
      final name = arg.substring(6);
      final value = execute.memoryEnv.env[name];
      if (value != null) {
        data[name] = value;
      }
    } else if (arg.startsWith('--res=') && execute != null) {
      // --res=a|index|name,1,2,3
      final argName = execute.key(arg);
      final value = await execute.repValue(arg);
      if (value != null && argName != null) {
        data[argName] = value;
      }
    } else if (arg.startsWith('--req=') && execute != null) {
      // --req=a|index|name,1,2,3
      final argName = execute.key(arg);
      final value = await execute.reqValue(arg);
      if (value != null && argName != null) {
        data[argName] = value;
      }
    }
  }
  return data;
}