Skip to content

Instantly share code, notes, and snippets.

@bsutton
Created November 8, 2019 06:27
Show Gist options
  • Save bsutton/acbda315533917a1eb76dcfd02947d5e to your computer and use it in GitHub Desktop.
Save bsutton/acbda315533917a1eb76dcfd02947d5e to your computer and use it in GitHub Desktop.
Dart: Overloading generic method
class MyRepo
{
}
class RealRepo<E extends Entity>
{
Repository<E> repo;
}
abstract class TypedEvent<T>
{
void run<R extends MyRepo>(R repo);
}
class DNDEvent extends TypedEvent<bool>
{
@override
void run(RealRepo<DND> repo){
}
}
}
class Repository<E extends Entity>
{}
class Entity
{}
class DND extends Entity
{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment