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