Created
January 16, 2020 12:30
-
-
Save lrhn/8d5c83b618ee47481c864328be19670e to your computer and use it in GitHub Desktop.
Example: Inference of type argument based on arguments only.
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
void f<T>(List<T> value, List<T> value2) { | |
print("f<$T>(${value.runtimeType}, ${value2.runtimeType})"); | |
} | |
main() { | |
f([2], [3]); | |
f([2], [3.1]); | |
f(["a"], [2]); | |
f([true], [null]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment