如果Dart声明?

Vik*_*ton 0 html google-maps dart

所以我正在使用Dart中的谷歌地图API处理一个项目,但我遇到了一些问题,我真的不知道如何修复.问题是我有这个If语句:

   if (querySelector("#input") == "202") {
      final location = (new InfoWindow(new InfoWindowOptions())
          ..position = new LatLng(40.316002, -76.034599)
          ..content = 'room 202'
      );
    }
Run Code Online (Sandbox Code Playgroud)

if语句的功能非常明显(它使用谷歌地图为Dart),但我似乎无法得到它.这是html部分:

 <form><p id="rly">
Enter room number</p><br>
<input type="text" id="input">
</form>
Run Code Online (Sandbox Code Playgroud)

任何建议或想法?先感谢您.

Gün*_*uer 5

你的问题对我来说并不是很清楚,但这条线很可能不符合你的期望

if (querySelector("#input") == "202") {
Run Code Online (Sandbox Code Playgroud)

querySelector("#input")返回Element带有id的input.元素永远不等于202.也许你的意思是

if ((querySelector("#input") as InputElement).value == "202") {
Run Code Online (Sandbox Code Playgroud)