is there a way to use static member as an interface for multi models in dart?
for example I can use interface normally as the example below.
interface class InterFace{
String get task=>'';
}
class Task1 implements InterFace{
@override
String get task => 'task1';
}
class Task2 implements InterFace{
@override
get task => 'task2';
}
String getTask(InterFace interFace)=>interFace.task;
how can I use it if "task" getter is static ?
or is there a way to use generic type to get static member for Task1 and Task2
class Task1 {
static String get task => 'task1';
}
class Task2 {
static get task => 'task2';
}
// like this
String getTask<T>()=> ??.task;
static members are not belong to the object made with class but to the type itself , so in this way it will not be possible to user static member via inheritance.May be you will explain what are you trying we can provide other solution?