添加 contains key
This commit is contained in:
parent
432ea546b5
commit
5b18497b11
14804
dart-js/out.js
14804
dart-js/out.js
File diff suppressed because one or more lines are too long
@ -117,7 +117,8 @@ void main() {
|
|||||||
|
|
||||||
// canvas
|
// canvas
|
||||||
CanvasElement canvas = CanvasElement(width: 100, height: 100);
|
CanvasElement canvas = CanvasElement(width: 100, height: 100);
|
||||||
CanvasRenderingContext2D ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
|
CanvasRenderingContext2D ctx =
|
||||||
|
canvas.getContext('2d') as CanvasRenderingContext2D;
|
||||||
ctx.fillStyle = 'black';
|
ctx.fillStyle = 'black';
|
||||||
ctx.fillRect(0, 0, 100, 100);
|
ctx.fillRect(0, 0, 100, 100);
|
||||||
ctx.fillStyle = 'white';
|
ctx.fillStyle = 'white';
|
||||||
@ -155,9 +156,12 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// call setTimeout
|
// call setTimeout
|
||||||
Js.context.callMethod('setTimeout', [Js.allowInterop(() {
|
Js.context.callMethod('setTimeout', [
|
||||||
print("延时1秒执行");
|
Js.allowInterop(() {
|
||||||
}), 1000]);
|
print("延时1秒执行");
|
||||||
|
}),
|
||||||
|
1000
|
||||||
|
]);
|
||||||
|
|
||||||
Map<String, int> test_map = {
|
Map<String, int> test_map = {
|
||||||
"a": 1,
|
"a": 1,
|
||||||
@ -174,6 +178,10 @@ void main() {
|
|||||||
// 修改
|
// 修改
|
||||||
test_map["b"] = 3;
|
test_map["b"] = 3;
|
||||||
|
|
||||||
|
if (test_map.containsKey("b")) {
|
||||||
|
test_map["b"] = 4;
|
||||||
|
}
|
||||||
|
|
||||||
// 查找
|
// 查找
|
||||||
print(test_map["b"]);
|
print(test_map["b"]);
|
||||||
// 遍历
|
// 遍历
|
||||||
|
Loading…
Reference in New Issue
Block a user