Skip to content

Instantly share code, notes, and snippets.

@bigbany
Created April 11, 2022 15:00
Show Gist options
  • Save bigbany/751e78172c503365bbbc3b140ffd5d30 to your computer and use it in GitHub Desktop.
Save bigbany/751e78172c503365bbbc3b140ffd5d30 to your computer and use it in GitHub Desktop.
about generic
void main(){
Lecture<String> lecture1 = Lecture('123','lecture1');
lecture1.printIdType();
}
// generic - 타입을 외부에서 받을때 사용
class Lecture<T> {
final T id;
final String name;
Lecture(this.id, this.name);
void printIdType(){
print(id.runtimeType);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment