samedi 15 octobre 2022

find all classes which which implemented another class in dart

I have a base generic class, and I want to find all classes which implements this class, do we have such thing in dart?

for clarifying this is my base class

abstract class IBaseClass<T>{
    void (T command);
}

and these are its implementation:

class CreateHandler implements IBaseClass<CreateCommand>{
    void (CreateCommand command)
    {
        //do something
    }
}

class DeleteHandler implements IBaseClass<DeleteCommand>{
    void (DeleteCommand command)
    {
        //do something
    }
}

Do we have something to pass base class to it and it returns these two classes? Maybe like this:

var implementations = GetImplementationsForClass(Typeof(IBaseClass<>));




Aucun commentaire:

Enregistrer un commentaire