Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample code for "Ever been stumped by <E>..." Medium post
class CacheItem<A> { // Using the letter A
CacheItem(A this.itemToCache);
final itemToCache;
String get detail => '''
Cached item: $itemToCache
The item type is $A
''';
}
void main() {
var cached = CacheItem<int>(1);
print(cached.detail);
// Output:
// Cached item: 1
// The item's type is int
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.