Created
March 27, 2023 18:18
-
-
Save tech-andgar/b11619b5f95f104cab9697621bd1c4c7 to your computer and use it in GitHub Desktop.
Check Generic Type Dart
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 main() { | |
checkGenericType<String>('Hello'); | |
} | |
checkGenericType<T>(T value) { | |
print(T.toString()); | |
if (T is String) { | |
print('l'); | |
} | |
if (value is String) { | |
print('2'); | |
} | |
if (T == String) { | |
print('3'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment