添加 contains key

This commit is contained in:
shenjack 2024-04-05 23:06:04 +08:00
parent 432ea546b5
commit 5b18497b11
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 7094 additions and 7728 deletions

File diff suppressed because one or more lines are too long

View File

@ -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"]);
// //