Created
March 6, 2022 21:08
-
-
Save kakikubo/f19c5dbea50ddde83811720c3b021826 to your computer and use it in GitHub Desktop.
動的型付け言語のように動く
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dynamic addOne(number) { | |
return 1 + number; | |
} | |
void main() { | |
print(addOne(1)); | |
// 以下は実行するとエラーが起きる(ビルドは通る) | |
// Uncaught Error: TypeError: "1": type 'JSString' is not a subtype of type 'num' | |
print(addOne("1")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment