作为示例,我可以如何请求一个简单的正文元素
//Sets static IP
public static void SetStaticIP(string ip, string newIP, string subnet = "255.255.255.0")
{
ManagementClass objMC = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection objMOC = objMC.GetInstances();
foreach (ManagementObject objMO in objMOC)
{
if ((bool)objMO["IPEnabled"])
{
try
{
object x = objMO["IPAddress"];
string[] str = (string[])x;
if (str[0] == ip)
{
ManagementBaseObject objNewIP = null;
ManagementBaseObject objSetIP = null;
objNewIP = objMO.GetMethodParameters("EnableStatic");
objNewIP["IPAddress"] = new string[] {newIP};
objSetIP = objMO.InvokeMethod("EnableStatic", objNewIP, null);
}
}
catch (Exception ex)
{
Console.WriteLine("Unable to Set IP : " + ex.Message);
}
}
}
}
//sets allocation to DHCP
public static bool setDHCP(string oldIP)
{
ManagementClass objMC = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection objMOC = objMC.GetInstances();
foreach (ManagementObject objMO in objMOC)
{
if (!(bool)objMO["IPEnabled"])
{
object x = objMO["IPAddress"];
string[] str = (string[])x;
if (str[0] == oldIP)
{
try
{
ManagementBaseObject objNewDNS = null;
ManagementBaseObject objSetDNS = objMO.GetMethodParameters("EnableDHCP");
objNewDNS = objMO.InvokeMethod("EnableDHCP", null, null);
return true;
}
catch (Exception) { return false; }
}
}
}
return false;
}
我的问题是如何处理这个复杂的问题?
var body = jsonEncode({
"name":"username",
"phone":"-",
});
我有"items" :[
{
"product_id" :9,
"quantity" : 2,
"price" : 20
},
{
"product_id" : 10,
"quantity" : 3 ,
"price" : 20
}
]
的鞭子包含所有数据
答案 0 :(得分:0)
http.get("url").then((response) {
map = json.decode(response.body);
}