I'm trying to create a parent type (IDataProvider) and a subtype (ILocalDataProvider), and then in a class, specify the subtype to take the place of the parent type. Here is what I mean:
abstract class IDataProvider {
ValueType get<ValueType>(String keyToRead);
}
abstract class ILocalDataProvider extends IDataProvider {
bool isKeyExistent(String key);
}
abstract class IDataSource {
IDataProvider dataProvider;
}
class LocalDataSource implements IDataSource {
LocalDataSource({@required this.dataProvider});
@override
ILocalDataProvider dataProvider; //*************** ERROR ON THIS LINE **********//
}
I'm getting this error:
'LocalDataSource.dataProvider=' ('void Function(ILocalDataProvider)') isn't a valid override of 'IDataSource.dataProvider=' ('void Function(IDataProvider)').
I thought that since ILocalDataProvider is a subtype of IDataProvider, it will be recognised as an IDataProvider?? What am I doing wrong?