Skip to content

Instantly share code, notes, and snippets.

@lrhn
Created January 16, 2020 12:30
Show Gist options
  • Save lrhn/8d5c83b618ee47481c864328be19670e to your computer and use it in GitHub Desktop.
Save lrhn/8d5c83b618ee47481c864328be19670e to your computer and use it in GitHub Desktop.
Example: Inference of type argument based on arguments only.
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