2020年12月23日星期三

How to inject dataProvider in repository using bloc pattern

As follow the bloc official repository pattern, it suggest the repository with multi-dataProvider, but how should I inject the dataProvider in the repository?

class Repository {      final DataProviderA dataProviderA;  // What's the way to init the DataProviderA in the repository.      final DataProviderB dataProviderB;        Future<Data> getAllDataThatMeetsRequirements() async {          final RawDataA dataSetA = await dataProviderA.readData();          final RawDataB dataSetB = await dataProviderB.readData();            final Data filteredData = _filterData(dataSetA, dataSetB);          return filteredData;      }  }  
https://stackoverflow.com/questions/65433143/how-to-inject-dataprovider-in-repository-using-bloc-pattern December 24, 2020 at 10:06AM

没有评论:

发表评论