不知道我在这里做错了什么。我有一个小程序设置来解析我的本地主机上的请求。我的客户有这个:
var local_num = null; // init to null
// my server is running on localhost at the moment
// using XMLHttpRequest I send it the value (it woud still be null)
request.open('GET', 'http://127.0.0.1:8080?player=${local_num}', false);
我的服务器代码应该能够处理这个:
action = params['action'];
var player_num = params['player'];
print ("got player num ${player_num}");
print(player_num is num); // false in both cases (see log below)
print(player_num is int);
if (player_num == null) { // never reaches inside of this if clause
print("received num is null, skipping parsing");
} else {
try {
var actual_number = Math.parseInt(received_num);
print("parsed"); // never gets here
} catch(var e) {
print(e); // should throw...
}
}
服务器记录此:
// it gets the request, player is null...
Instance of '_HttpRequest@14117cc4'
{player: null}
got player num null
false
false
但随后繁荣!-> 在 dart:bootstrap_impl ... 第 1255 行附近
int pow(int exponent) {
throw "Bigint.pow not implemented";
}