Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Kotlin中的可变阴影_Android_Kotlin - Fatal编程技术网

Android Kotlin中的可变阴影

Android Kotlin中的可变阴影,android,kotlin,Android,Kotlin,我在下面的代码中得到了变量阴影警告,因为它是嵌套的。如何正确修复此警告 Network.callServer(Constants.url + "/get_call_one.php", dataToSend) { if (it["result"].toString() == "PASS") { Network.callServer(Constants.url + "/get_call_two.php", dataToSend) { if (i

我在下面的代码中得到了变量阴影警告,因为它是嵌套的。如何正确修复此警告

Network.callServer(Constants.url + "/get_call_one.php", dataToSend) {
    if (it["result"].toString() == "PASS")
    {
        Network.callServer(Constants.url + "/get_call_two.php", dataToSend) {
            if (it["result"].toString() == "PASS")
            {
                // do stuff
            }
        }
    }
}

代码有一些隐式隐藏声明,它->

只需重命名其中一个或两个:

Network.callServer(Constants.url + "/get_call_one.php", dataToSend) { it1->
    if (it1["result"].toString() == "PASS")
    {
        Network.callServer(Constants.url + "/get_call_two.php", dataToSend) { it2->
            if (it2["result"].toString() == "PASS")
            {
                // do stuff
            }
        }
    }
}

代码有一些隐式隐藏声明,它->

只需重命名其中一个或两个:

Network.callServer(Constants.url + "/get_call_one.php", dataToSend) { it1->
    if (it1["result"].toString() == "PASS")
    {
        Network.callServer(Constants.url + "/get_call_two.php", dataToSend) { it2->
            if (it2["result"].toString() == "PASS")
            {
                // do stuff
            }
        }
    }
}

你可以将你的内心世界重新命名为新的;类似项目或数据


你可以将你的内心世界重新命名为新的;类似项目或数据


为lambda命名变量{x->//在此处添加代码}为lambda命名变量{x->//在此处添加代码}
Network.callServer(Constants.url + "/get_call_one.php", dataToSend) { it->
    if (it["result"].toString() == "PASS")
    {
        Network.callServer(Constants.url + "/get_call_two.php", dataToSend) { item ->
            if (item["result"].toString() == "PASS")
            {
                // do stuff
            }
        }
    }
}