Skip to content

Instantly share code, notes, and snippets.

@kakikubo
Created March 6, 2022 21:08
Show Gist options
  • Save kakikubo/f19c5dbea50ddde83811720c3b021826 to your computer and use it in GitHub Desktop.
Save kakikubo/f19c5dbea50ddde83811720c3b021826 to your computer and use it in GitHub Desktop.
動的型付け言語のように動く
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